Skip to content

Commit 95e3e20

Browse files
authored
feat: GenericObject
1 parent 9203d32 commit 95e3e20

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,3 +427,18 @@ In this usage, the type essentially is a no-op, and means nothing at all.
427427
In all other usages, [including in the `extends` clause of a generic type parameter](https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABMOcA8AVRBTAHlbMAEwGdEBvAXwD4AKABwEMAnRgWwC5EMBKCygFACUcWlGYhsPANzDUtAIwy5oqspG0wIADbaZiAPQGcuetmjYiOZszjMBQA), it means "anything non-nullish".
428428
429429
_Originally posted by @bradzacher in https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492_
430+
431+
432+
### `GenericObject`
433+
434+
```typescript
435+
/**
436+
* Helper to avoid writing `Record<string, unknown>` everywhere you would usually use "object".
437+
*
438+
* @example (data: GenericObject) => void
439+
* @example variables: GenericObject<string>
440+
*
441+
* @see https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-632833366
442+
*/
443+
export type GenericObject<T = unknown> = Record<string, T>;
444+
```

0 commit comments

Comments
 (0)