( value: T | null | undefined, message: string, )
| 350 | } |
| 351 | |
| 352 | const getRequiredValue = <T,>( |
| 353 | value: T | null | undefined, |
| 354 | message: string, |
| 355 | ): T => { |
| 356 | if (value == null) { |
| 357 | throw new Error(message); |
| 358 | } |
| 359 | |
| 360 | return value; |
| 361 | }; |
| 362 | |
| 363 | const getPostTitle = (post: Pick<Post, 'title'>, label: string): string => |
| 364 | getRequiredValue(post.title, `Expected ${label} post title`); |
no outgoing calls
no test coverage detected