import {expectAssignable, expectType} from 'tsd'; import type {EmptyObject, IsEmptyObject} from '../index'; declare let foo: EmptyObject; expectAssignable<{}>(foo); expectAssignable<{}>(foo = {}); // @ts-expect-error foo = []; // @ts-expect-error foo = {x: 1}; // @ts-expect-error foo = 42; // @ts-expect-error foo = null; // @ts-expect-error foo.bar = 42; // @ts-expect-error foo.bar = {}; expectType>(true); expectType>(true); expectType>(false); expectType>(false); expectType void>>(false); type Union = EmptyObject | {id: number}; const bar: Union = {}; // @ts-expect-error const _a: unknown = bar.id; const baz: Union = {id: 42}; expectType<{id: number}>(baz);