Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new TypeScript declarations conflict with existing runtime behavior and supported APIs, including non-string return values, nullable bidders, numeric-string sizes, and constructor usage.
1 open issue
What changed in this PR
Prepares the core utility layer for TypeScript migration by adding explicit contracts and updating dependent code.
Changes:
- Adds parameter, return, and generic types throughout
src/utils.tsand related helpers. - Migrates
CachedApiWrapperto TypeScript and adds browser API declarations. - Updates rendering, bidder partitioning, and adapter types to accommodate the utility signatures.
| File | Description |
|---|---|
src/utils/winDimensions.ts |
Defines window dimension and orientation types. |
src/utils/reducers.ts |
Types generic comparators and bid reducers. |
src/utils/objects.ts |
Annotates validation inputs and type guards. |
src/utils/ipUtils.ts |
Types IP inputs, results, and masks. |
src/utils/gdpr.ts |
Defines the consent helper’s input shape. |
src/utils/focusTimeout.ts |
Types suspended callbacks and timer handles. |
src/utils/cpm.ts |
Adds bid adjustment function signatures. |
src/utils/cachedApiWrapper.ts |
Adds the TypeScript cache-wrapper implementation. |
src/utils/cachedApiWrapper.js |
Removes the replaced JavaScript implementation. |
src/utils.ts |
Adds utility contracts and type-compatible expressions. |
src/types/local/scheduler.d.ts |
Declares the browser scheduling API. |
src/types/local/safeframe.d.ts |
Declares SafeFrame browser interfaces. |
src/adRendering.ts |
Preserves bid subtype information during rendering preparation. |
src/adapterManager.ts |
Types partition constants and bidder collections. |
modules/multibid/index.ts |
Types received bids in the targeting hook. |
modules/asterioBidAdapter.ts |
Extends server response fields. |
modules/ad_spiroBidAdapter.ts |
Adds an OpenRTB response type assertion. |
Review effort: Balanced
| * Wraps the properties of the object returned by `getTarget` flagged in `props` with getters that | ||
| * read through to the target once, and serve the cached value until `reset()` is called. | ||
| */ | ||
| export function CachedApiWrapper<T = any>(this: { obj: T; reset: () => void }, getTarget: () => any, props: CachedApiProps) { |
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.

ABOUT
src/utils.jstypescript migration