diff --git a/002.ts b/002.ts index 5209041..9fc27d6 100644 --- a/002.ts +++ b/002.ts @@ -39,7 +39,8 @@ declare function verifyOIB(oib: string): boolean; function payTaxes(entity: Human | Company): void { verifyOIB(entity.oib); - // entity.companyName; -> Property 'companyName' does not exist on type 'Human'.ts(2339) + // entity.companyName; + // result: Property 'companyName' does not exist on type 'Human'.ts(2339) let name: string; if ('companyName' in entity) { diff --git a/003.ts b/003.ts index eceea00..bd5f29e 100644 --- a/003.ts +++ b/003.ts @@ -36,7 +36,7 @@ let _myObject: ObjectInterface; _myObject!.a // string _myObject!.b // string -// Side note: Notice the `!` part, use it wisely +// Side note: Notice the `!` operator, use it wisely // This throws an error: // type ObjectType = { diff --git a/007.ts b/007.ts index d9c8f4e..f47b077 100644 --- a/007.ts +++ b/007.ts @@ -101,7 +101,9 @@ type ImmutableObject = { readonly [K in keyof T]: Immutable }; * }; * type ResultType = KeyOfType; // "a" | "b" | "c" | "d" | "e" */ -declare type KeyOfType = { [K in keyof T]: T[K] extends Type ? K : never}[keyof T]; +declare type KeyOfType = { + [K in keyof T]: T[K] extends Type ? K : never +}[keyof T]; /** * Get all keys of `T` that are assignable to `Type`. @@ -118,7 +120,9 @@ declare type KeyOfType = { [K in keyof T]: T[K] extends Type ? K : neve * }; * type ResultType = KeyWithType; // "a" | "b" | "c" | "d" | "f" */ -declare type KeyWithType = { [K in keyof T]: Type extends T[K] ? K : never}[keyof T]; +declare type KeyWithType = { + [K in keyof T]: Type extends T[K] ? K : never +}[keyof T]; // --- diff --git a/008.tsx b/008.tsx index 2209f72..1a3447a 100644 --- a/008.tsx +++ b/008.tsx @@ -69,7 +69,7 @@ interface OwnProps { id: number; } -function mapStateToProps(rootState: RootStoreState, ownProps: OwnProps) { +function mapStateToProps(rootState: RootStoreState, ownProps: OwnProps) { return { value: rootState.targetReducer.lookup[ownProps.id] }