Repository navigation
fix: declare Gleap.setStyles with its positional arguments - #230
Merged
Merged
Conversation
… makes The positional calls the SDK accepts must compile and the object form, which throws on the page, must not. Fails on master: index.d.ts declares setStyles with one object. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
index.d.ts declared setStyles with one object since v6.4.5, while the runtime takes primaryColor, headerColor, buttonColor and seven optional positional arguments. A call in the declared form threw on the page and injected no styles. Types and changelog only; no runtime change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TobiasDuelli
marked this pull request as ready for review
November 23, 2026 16:20
LucaB01
approved these changes
Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
index.d.tshas declaredGleap.setStyleswith a single object since v6.4.5, but the runtime (src/Gleap.js) takes positional arguments. A call written the way the typings describe throwsTypeError: e.substr is not a functionon the host page and injects no styles. This PR makes the declaration describe what the runtime accepts. No runtime change.Before:
After (matches
static setStyles(...)and its defaults; JSDoc lists the defaults and the six launcher positions):TypeScript projects that call
setStyleswith an object now get a compile error at that call. That call never worked, so the error points them at a real bug.CHANGELOG.mdhas anUnreleasedentry saying this.The README does not document
setStyles, so it has no object form to correct.Test
New
smoke/typings.spec.mjscompilessmoke/typings.fixture.tsagainstindex.d.tswith the TypeScript compiler API, using the options fromnpm run typecheck. The fixture has a 3-argument call and a 10-argument call that must compile, and an object-form call marked@ts-expect-errorthat must not compile. The test went in as its own commit and failed onmasterfor the expected reasons:It uses
typescript, which is already a devDependency. No new dependency, no script change.Proof
npm run typecheck: exit 0npm run test:smoke: 9 passed, including the new one and "every function index.d.ts declares exists on window.Gleap"node tools/quality/check.mjs: 0 problemsnpx -y npm@10.9.2 ci --ignore-scripts --dry-run: exit 0npm run buildonmasterand on this branch: all 921 files underbuild/andpublished/have identical SHA-256 hashes. The build artifacts are not committed..gleap-styleswith no page error. The object form throwsTypeError: e.substr is not a function.Not in this PR (typings only, for a follow-up)
index.d.ts:openURL,disableQueryParams,checkForUrlParams,disableLocalStorage,triggerCustomAction,startFeedbackFlowWithOptions,startFeedbackFlowNow,buildTourStartUrl,checkForUncompletedTour,startProductTourWithConfig,showBanner,showModal,showNotificationstartProductTour(tourId)is declared without its optional second parametercheckStartUrlsetLiveSiteis declared, but the runtime has no such function (it is allow-listed in the smoke test)agent-message-sent,agent-reply-received,agent-errorandagent-conversation-createdare in theGleap.onunion, but they only fire asgleap-agent-*DOM events on the agent conversation element🤖 Generated with Claude Code