{"record":{"id":"3c2eaf649aa6d8bc","repo":"usablica/intro.js","slug":"provided-callback-for-onhintclose-was-not-a-functi","errorCode":null,"errorMessage":"Provided callback for onhintclose was not a function.","messagePattern":"Provided callback for onhintclose was not a function\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/packages/hint/hint.ts","lineNumber":439,"sourceCode":"  }\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   */\n  onHintClose(providedCallback: hintCloseCallback) {\n    if (isFunction(providedCallback)) {\n      this.callbacks.hintClose = providedCallback;\n    } else {\n      throw new Error(\"Provided callback for onhintclose was not a function.\");\n    }\n    return this;\n  }\n\n  /**\n   * @deprecated onhintclose is deprecated, please use onHintClose instead\n   * @param providedCallback\n   */\n  onhintclose(providedCallback: hintCloseCallback) {\n    this.onHintClose(providedCallback);\n  }\n}\n","sourceCodeStart":421,"sourceCodeEnd":452,"githubUrl":"https://github.com/usablica/intro.js/blob/e5517e6a24e0530f87885af9fb2a69bafd1d4a6b/src/packages/hint/hint.ts#L421-L452","documentation":"Hint class onHintClose registers a callback fired when a hint is closed. Its if/else structure throws this exact error in the else branch when isFunction(providedCallback) is false. Same defensive contract as the other hint setters: callbacks must be functions.","triggerScenarios":"introJs().onHintClose() with no argument, or with a non-function such as null, an async wrapper object, or a Promise, typically from an undefined variable or wrong config key.","commonSituations":"Using the deprecated lowercase alias onhintclose with code written for a different callback signature; TypeScript users passing possibly-undefined values from optional config; assigning callbacks inside conditions that don't run.","solutions":["Call onHintClose with a concrete function: introJs().onHintClose(function(hintObject){ ... }).","Inspect the argument: ensure the callback variable is defined at call time and typeof === 'function'.","Replace deprecated onhintclose usage with onHintClose and pass the function directly.","Fix async assignment order — register the callback only after the handler is loaded.","Add a caller-side guard to skip or default the registration."],"exampleFix":"// before\nintroJs().onHintClose(opts.onClose); // opts.onClose is undefined\n// after\nif (typeof opts.onClose === 'function') {\n  introJs().onHintClose(opts.onClose);\n}","handlingStrategy":"validation","validationCode":"if (typeof closeCb === 'function') { introJs().onHintClose(closeCb); }","typeGuard":"function isCallback(v: unknown): v is () => void { return typeof v === 'function'; }","tryCatchPattern":"try {\n  intro().onHintClose(cb);\n} catch (e) {\n  if (String(e.message).includes('onhintclose was not a function')) {\n    console.warn('Skipping onHintClose registration: bad callback');\n  } else { throw e; }\n}","preventionTips":["Migrate off deprecated onhintclose to onHintClose","Coalesce optional callbacks: cb || (() => {})","Check load order so handlers exist before registration","Keep one config-to-callback mapping to avoid key typos"],"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"}