Skip to content

Instantly share code, notes, and snippets.

@VladSez
Last active December 23, 2022 01:00
Show Gist options
  • Save VladSez/44ebe3624c072de881becd7dd408dcf5 to your computer and use it in GitHub Desktop.
Save VladSez/44ebe3624c072de881becd7dd408dcf5 to your computer and use it in GitHub Desktop.
Ts quirk on “object”
https://github.com/typescript-eslint/typescript-eslint/issues/5947
Don't use `{}` as a type. `{}` actually means "any non-nullish value".
- If you want a type meaning "any object", you probably want `object` instead.
- If you want a type meaning "any value", you probably want `unknown` instead.
- If you want a type meaning "empty object", you probably want `Record<string, never>` instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment