Skip to content

Commit e336c6c

Browse files
null-check value in getGeneratorDefinition
Tests were failing. Also, assert the last return is a GeneratorDefinition. I have to clean this up, but essentially TS is being unable to narrow this down. An InputOutputGeneratorOptions is a one level deep object with GeneratorOptions, so the recursive call will inevitably trickle down to a base case where we _do not_ have an InputOutputGeneratorOptions.
1 parent bfa5db2 commit e336c6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ const getGeneratorDefinition = (
102102
};
103103
}
104104

105-
if ('input' in value && 'output' in value) {
105+
if (value !== undefined && 'input' in value && 'output' in value) {
106106
return getGeneratorDefinition(value[generatorMode], generatorMode);
107107
}
108108

109-
return value;
109+
return value as GeneratorDefinition;
110110
};
111111

112112
const getCasualCustomValue = (

0 commit comments

Comments
 (0)