Skip to content

Instantly share code, notes, and snippets.

@safareli
Created May 4, 2022 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save safareli/44c87d00d3b317045b6f078ec9938c57 to your computer and use it in GitHub Desktop.
Save safareli/44c87d00d3b317045b6f078ec9938c57 to your computer and use it in GitHub Desktop.
Check that type of record is an empty record in typescript type level
declare const test1: {}
declare const test2: {foo: 1}
declare const test3: {foo: 1,asda:11}
declare const assertRecordIsEmpty:(input: Record<keyof any,never>) => void
assertRecordIsEmpty(test1)
assertRecordIsEmpty(test2)
assertRecordIsEmpty(test3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment