Open JPMeehan opened 4 months ago
This test suite from tests/types/utils.test-d.ts should all work, but it doesn't because the guarantee is stripped.
tests/types/utils.test-d.ts
declare const storedUser: StoredDocument<User>; expectTypeOf(storedUser.id).toEqualTypeOf<string>(); expectTypeOf(storedUser._id).toEqualTypeOf<string>(); expectTypeOf(storedUser._source._id).toEqualTypeOf<string>(); expectTypeOf(storedUser.toJSON()._id).toEqualTypeOf<string>(); expectTypeOf(storedUser.toJSON()._id).toEqualTypeOf<string>(); expectTypeOf(storedUser.toObject()._id).toEqualTypeOf<string>(); expectTypeOf(storedUser.toObject()._id).toEqualTypeOf<string>(); expectTypeOf(storedUser.toObject(false)._id).toEqualTypeOf<string>(); expectTypeOf(storedUser.toObject(false)._id).toEqualTypeOf<string>(); expectTypeOf(storedUser.clone()).toEqualTypeOf<StoredDocument<User>>();
This test suite from
tests/types/utils.test-d.ts
should all work, but it doesn't because the guarantee is stripped.