Skip to content

Commit 322c233

Browse files
committed
fix: Node param type null needs to fallback to function param type
1 parent 8eab3b0 commit 322c233

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/schema/getSignatureSchema.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ export const getSignatureSchema = (
8585
// Extract parameter types from the function definition
8686
const funktionParameterTypes = extractFunctionParameterTypes(checker, funktion, node)
8787

88+
// Fall back to function param type when node param resolved to undefined (e.g. value: null passed as generic type param)
89+
const mergedParameterTypes = nodeParameterTypes?.map((type, index) =>
90+
(type.flags & ts.TypeFlags.Undefined) !== 0
91+
? (funktionParameterTypes?.[index] ?? type)
92+
: type
93+
)
94+
8895
// Identify parameter dependencies based on type parameters
8996
const funktionDependencies = getParameterDependencies(funktion!)
9097

@@ -93,7 +100,7 @@ export const getSignatureSchema = (
93100
nodeId,
94101
checker,
95102
node!,
96-
nodeParameterTypes,
103+
mergedParameterTypes,
97104
funktionParameterTypes,
98105
funktionDependencies,
99106
nodeId ? declaredFunctionsMap : new Map(),

0 commit comments

Comments
 (0)