pacc 9.3.2 → 9.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/types.mjs +9 -10
package/package.json
CHANGED
package/src/types.mjs
CHANGED
|
@@ -105,22 +105,21 @@ export const types = {
|
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
109
|
-
* @param {string|undefined} type
|
|
108
|
+
* Throw if type is not known.
|
|
109
|
+
* @param {Type|string|undefined} type
|
|
110
110
|
* @param {any} origin
|
|
111
111
|
* @returns {Type}
|
|
112
112
|
*/
|
|
113
113
|
function raiseOnUnknownType(type, origin) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (types[type]) {
|
|
117
|
-
return types[type];
|
|
118
|
-
}
|
|
119
|
-
case "undefined":
|
|
120
|
-
throw new Error(`Unknown type ${type} in '${origin}'`, { cause: type });
|
|
114
|
+
if (types[type]) {
|
|
115
|
+
return types[type];
|
|
121
116
|
}
|
|
122
117
|
|
|
123
|
-
|
|
118
|
+
if (types[type?.name] === type) {
|
|
119
|
+
return type;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
throw new Error(`Unknown type ${type} in '${origin}'`, { cause: type });
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
export function addType(type) {
|