type-fest icon indicating copy to clipboard operation
type-fest copied to clipboard

`EmptyObject`'s use of non-exported symbol declaration causes TypeScript errors in monorepo environment with project references

Open icopp opened this issue 8 months ago • 2 comments

In a monorepo environment with project references, using EmptyObject results in an inexplicable error:

Return type of exported function has or is using name 'emptyObjectSymbol' from external module "(path)/node_modules/type-fest/source/empty-object" but cannot be named.

As far as I can tell, this is an unfixed TypeScript bug (they've claimed it's fixed but it obviously isn't) in the difference between interface and type behavior (maybe? see comments).

icopp avatar Apr 02 '25 20:04 icopp

Actually, with more testing here, the use of interface only works sometimes. This is extremely weird and I don't know for sure what any actual fix is.

This may be some kind of new-ish regression in TypeScript, there are a lot of people very confused about similar errors.

icopp avatar Apr 02 '25 20:04 icopp