Structure fixtures so they can be tested for exclusivity without extensive exclude declarations

This commit is contained in:
Bjorn Stromberg 2025-06-05 11:27:29 +08:00
parent 882a91c54f
commit 266d23f7bb
2 changed files with 422 additions and 730 deletions

View file

@ -209,10 +209,14 @@ function detect(value: unknown): TypeName {
}
const tagType = getObjectType(value);
if (tagType) {
if (tagType && tagType !== 'Object') {
return tagType;
}
if (hasPromiseApi(value)) {
return 'Promise';
}
if (value instanceof String || value instanceof Boolean || value instanceof Number) {
throw new TypeError('Please don\'t use object wrappers for primitive types');
}
@ -1120,7 +1124,7 @@ const methodTypeMap = {
isWhitespaceString: 'whitespace string',
} as const;
function keysOf<T extends Record<PropertyKey, unknown>>(value: T): Array<keyof T> {
export function keysOf<T extends Record<PropertyKey, unknown>>(value: T): Array<keyof T> {
return Object.keys(value) as Array<keyof T>;
}

File diff suppressed because it is too large Load diff