Skip to content

Commit 2afeb59

Browse files
committed
fix: do not throw error regarding generic promises
1 parent 447428b commit 2afeb59

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/titanium-docgen/validate.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,12 @@ function validateDataType(type, fullTypeContext) {
434434
// Should it have been written as a complex type?
435435
if (common.COMPLEX_TYPES.has(type)) {
436436
const argCount = common.COMPLEX_TYPES.get(type); // may be 0 if Function/Callback
437-
// Enforce as ERROR if Promise/Set/Map doesn't have exact generic type count
438-
const severity = [ 'Map', 'Set', 'Promise' ].includes(type) ? ERROR : WARNING;
437+
// Skip validation for Promise to allow Promise without generics (Promise<T> not supported by build system)
438+
if (type === 'Promise') {
439+
return errors;
440+
}
441+
// Enforce as ERROR if Set/Map doesn't have exact generic type count
442+
const severity = [ 'Map', 'Set' ].includes(type) ? ERROR : WARNING;
439443
errors.push(new Problem(`${type} ${severity === ERROR ? 'must' : 'should'} have ${argCount || 'any number of'} generic type(s) specified, but had 0: ${fullTypeContext || type}`, severity));
440444
} else if (type === 'Object') {
441445
// Warn about generic Object types (Dictionary is handled above as a complex type)

0 commit comments

Comments
 (0)