{"record":{"id":"dbd84af94c7110c1","repo":"usablica/intro.js","slug":"provided-callback-for-onhintclick-was-not-a-functi","errorCode":null,"errorMessage":"Provided callback for onhintclick was not a function.","messagePattern":"Provided callback for onhintclick was not a function\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/packages/hint/hint.ts","lineNumber":416,"sourceCode":"    this.callbacks.hintsAdded = providedCallback;\n    return this;\n  }\n\n  /**\n   * @deprecated onhintsadded is deprecated, please use onHintsAdded instead\n   * @param providedCallback callback function\n   */\n  onhintsadded(providedCallback: hintsAddedCallback) {\n    this.onHintsAdded(providedCallback);\n  }\n\n  /**\n   * Callback for when hint items are clicked\n   * @param providedCallback callback function\n   */\n  onHintClick(providedCallback: hintClickCallback) {\n    if (!isFunction(providedCallback)) {\n      throw new Error(\"Provided callback for onhintclick was not a function.\");\n    }\n\n    this.callbacks.hintClick = providedCallback;\n    return this;\n  }\n\n  /**\n   * @deprecated onhintclick is deprecated, please use onHintClick instead\n   * @param providedCallback\n   */\n  onhintclick(providedCallback: hintClickCallback) {\n    this.onHintClick(providedCallback);\n  }\n\n  /**\n   * Callback for when hint items are closed\n   * @param providedCallback callback function\n   */","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/usablica/intro.js/blob/e5517e6a24e0530f87885af9fb2a69bafd1d4a6b/src/packages/hint/hint.ts#L398-L434","documentation":"The Hint class onHintClick method stores the per-hint-click callback in this.callbacks.hintClick. It validates the argument with isFunction and throws when it is not a function, preventing a later TypeError when a hint item is clicked.","triggerScenarios":"introJs().onHintClick(undefined| null | 'onClick' | obj) — passing anything other than a function, often because the variable holding the callback is undefined or the function name string was passed instead of the reference.","commonSituations":"Passing the string name of a function instead of the function; destructuring config that misses the key; minification changing exports so the referenced handler is undefined; copy-paste between hint and tour APIs with wrong callback type.","solutions":["Pass a real function reference: introJs().onHintClick(function(targetElement){ ... }).","console.log(typeof handler) to find why the value is not a function; fix the source assignment.","If configuring via data attributes/JSON, wire the handler in JS after parse instead of trying to inline it.","Use the current camelCase API (onHintClick) and correct callback signature.","Guard the call site with a type check before registering."],"exampleFix":"// before\nintroJs().onHintClick('handleHintClick'); // string, not function\n// after\nintroJs().onHintClick(handleHintClick); // actual function reference","handlingStrategy":"validation","validationCode":"if (typeof onHintClickCb !== 'function') { throw new TypeError('onHintClick expects a function'); }\nintroJs().onHintClick(onHintClickCb);","typeGuard":"const isFn = (v: unknown): v is (...args: unknown[]) => void => typeof v === 'function';","tryCatchPattern":"try {\n  intro().onHintClick(cb);\n} catch (e) {\n  if (/onhintclick was not a function/.test(e.message)) {\n    intro().onHintClick(() => {}); // safe fallback\n  } else { throw e; }\n}","preventionTips":["Never pass a string function name; pass the reference","Verify typeof handler === 'function' before any intro.js registration","Centralize callback wiring in one setup function to spot bad values","Don't pass Promises where functions are expected; wrap with () => promise.then(...)"],"tags":["callbacks","type-validation","api-misuse"],"backgroundTag":"callback-not-a-function","analyzedSha":"e5517e6a24e0530f87885af9fb2a69bafd1d4a6b","analyzedAt":"2026-08-31T22:12:26.007Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}