Skip to content

Commit

Permalink
add 18048 error
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-north committed Sep 30, 2023
1 parent cf4cf7f commit 7601fd4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Imagine if we were passing this value through several other functions before rea
type checking alerted us to a problem!

```ts twoslash
// @errors: 2531 2339 2532
// @errors: 2531 2339 2532 18048
type JSONPrimitive = string | number | boolean | null
type JSONObject = { [k: string]: JSONValue }
type JSONArray = JSONValue[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ operator just tells TypeScript to ignore that possibility.
If the value _does_ turn out to be missing, you will get the familiar `cannot call foo on undefined` family of errors at runtime:

```ts twoslash
// @errors: 2532
// @errors: 2532 18048
type GroceryCart = {
fruits?: { name: string; qty: number }[]
vegetables?: { name: string; qty: number }[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ d.rhubarb.join(", ") // 💥
My advice was to explicitly type it as

```ts twoslash
// @errors: 2532
// @errors: 2532 18048
type Dict<T> = { [K: string]: T | undefined }
const d: Dict<string[]> = {}
d.rhubarb.join(", ") // 💥
Expand Down

0 comments on commit 7601fd4

Please sign in to comment.