Skip to content

Commit e227f2a

Browse files
authored
Core: skipLibCheck avoidance adjustments in TS build (prebid#14599)
* Core: skipLibCheck avoidance adjustments in TS build * linting * fixing order * package-lock * change googletag to any * allowJs: false * clean up * clean up
1 parent 7f0b028 commit e227f2a

10 files changed

Lines changed: 26 additions & 15 deletions

modules/consentManagementTcf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export type TCFConsentData = {
4545
/**
4646
* The response from the CMP.
4747
*/
48-
vendorData: Record<string, unknown>;
48+
vendorData: Record<string, string>;
4949
/**
5050
* Additional consent string, if provided by the CMP.
5151
* @see https://support.google.com/admanager/answer/9681920?hl=en

modules/michaoBidAdapter.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ortbConverter } from '../libraries/ortbConverter/converter.js';
22
import { type BidderSpec, registerBidder } from '../src/adapters/bidderFactory.js';
3+
import { Bid } from '../src/bidfactory.js';
34
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
45
import { Renderer } from '../src/Renderer.js';
56
import {
@@ -274,7 +275,7 @@ const converter = ortbConverter<typeof ENV.BIDDER_CODE>({
274275
id: bidRequest.bidId,
275276
adUnitCode: bidRequest.adUnitCode,
276277
});
277-
renderer.setRender((bid) => {
278+
renderer.setRender((bid: Bid) => {
278279
bid.renderer.push(() => {
279280
const inRenderer = new (window as any).InVideoRenderer();
280281
inRenderer.render(bid.adUnitCode, bid);

modules/pubstackBidAdapter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { BidRequest, ClientBidderRequest } from '../src/adapterManager.js';
88
import { ORTBRequest } from '../src/prebid.public.js';
99
import { config } from '../src/config.js';
1010
import { SyncType } from '../src/userSync.js';
11-
import { ConsentData, CONSENT_GDPR, CONSENT_USP, CONSENT_GPP } from '../src/consentHandler.js';
11+
import { ConsentDataForKey, CONSENT_GDPR, CONSENT_USP, CONSENT_GPP } from '../src/consentHandler.js';
1212
import { getGlobal } from '../src/prebidGlobal.js';
1313

1414
const BIDDER_CODE = 'pubstack';
@@ -32,9 +32,9 @@ type GetUserSyncFn = (
3232
pixelEnabled: boolean;
3333
},
3434
responses: ServerResponse[],
35-
gdprConsent: null | ConsentData[typeof CONSENT_GDPR],
36-
uspConsent: null | ConsentData[typeof CONSENT_USP],
37-
gppConsent: null | ConsentData[typeof CONSENT_GPP]) => ({ type: SyncType, url: string })[]
35+
gdprConsent: null | ConsentDataForKey<typeof CONSENT_GDPR>,
36+
uspConsent: null | ConsentDataForKey<typeof CONSENT_USP>,
37+
gppConsent: null | ConsentDataForKey<typeof CONSENT_GPP>) => ({ type: SyncType, url: string })[]
3838

3939
const siteIds: Set<string> = new Set();
4040
let cntRequest = 0;

src/adapterManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const _bidderRegistry = {};
8686
const _aliasRegistry: { [aliasCode: BidderCode]: BidderCode } = {};
8787
const _analyticsRegistry: { [P in AnalyticsProvider]?: { adapter: AnalyticsAdapter<P>, gvlid?: number } } = {};
8888

89-
let _s2sConfigs = [];
89+
let _s2sConfigs : any[] | any = [];
9090
config.getConfig('s2sConfig', config => {
9191
if (config && config.s2sConfig) {
9292
_s2sConfigs = isArray(config.s2sConfig) ? config.s2sConfig : [config.s2sConfig];
@@ -927,6 +927,7 @@ const adapterManager = {
927927
config: AnalyticsConfig<keyof AnalyticsProviderConfig>
928928
| AnalyticsConfig<AnalyticsProvider>
929929
| AnalyticsConfig<AnalyticsProvider>[]
930+
| any
930931
) {
931932
if (!isArray(config)) {
932933
config = [config];

src/adapters/bidderFactory.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import type { BidderCode, StorageDisclosure } from "../types/common.d.ts";
4141
import type { Ajax, AjaxOptions, XHR } from "../ajax.ts";
4242
import type { AddBidResponse } from "../auction.ts";
4343
import type { MediaType } from "../mediaTypes.ts";
44-
import { CONSENT_GDPR, CONSENT_GPP, CONSENT_USP, type ConsentData } from "../consentHandler.ts";
44+
import { CONSENT_GDPR, CONSENT_GPP, CONSENT_USP, type ConsentDataForKey } from "../consentHandler.ts";
4545

4646
/**
4747
* This file aims to support Adapters during the Prebid 0.x -> 1.x transition.
@@ -153,9 +153,9 @@ export interface BidderSpec<BIDDER extends BidderCode> extends StorageDisclosure
153153
pixelEnabled: boolean;
154154
},
155155
responses: ServerResponse[],
156-
gdprConsent: null | ConsentData[typeof CONSENT_GDPR],
157-
uspConsent: null | ConsentData[typeof CONSENT_USP],
158-
gppConsent: null | ConsentData[typeof CONSENT_GPP]
156+
gdprConsent: null | ConsentDataForKey<typeof CONSENT_GDPR>,
157+
uspConsent: null | ConsentDataForKey<typeof CONSENT_USP>,
158+
gppConsent: null | ConsentDataForKey<typeof CONSENT_GPP>
159159
) => ({ type: SyncType, url: string })[];
160160
alwaysHasCapacity?: boolean;
161161
}

src/bidfactory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export interface NativeBidProperties {
167167

168168
export interface VideoBidProperties {
169169
mediaType: 'video' | 'audio';
170+
videoCacheKey?: string;
170171
}
171172

172173
type BidFrom<RESP, PROPS> = BaseBid & Omit<RESP, keyof BaseBid | keyof PROPS> & PROPS;

src/consentHandler.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export interface ConsentData {
2222
[CONSENT_COPPA]: boolean;
2323
}
2424

25+
/** Resolves to ConsentData[K] when module has augmented that key, else unknown (core-only build). */
26+
export type ConsentDataForKey<K extends ConsentType> = K extends keyof ConsentData ? ConsentData[K] : unknown;
27+
2528
type ConsentDataFor<T extends ConsentType> = T extends keyof ConsentData ? ConsentData[T] : null;
2629

2730
// eslint-disable-next-line @typescript-eslint/no-empty-object-type

src/events.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ export interface Events extends AllEvents {
2424
}
2525

2626
export type EventIDs = {
27-
[K in Event]: K extends keyof typeof EVENT_ID_PATHS ? Events[K][0][(typeof EVENT_ID_PATHS)[K]] : undefined;
27+
[K in Event]:
28+
K extends keyof typeof EVENT_ID_PATHS
29+
? Events[K][0] extends { [P in (typeof EVENT_ID_PATHS)[K]]: infer V }
30+
? V
31+
: unknown
32+
: undefined;
2833
};
2934

3035
export type Event = keyof Events;

src/targeting.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function sortByDealAndPriceBucketOrCpm(useCpm = false) {
134134
* @param adUnitCodes
135135
* @param getSlots
136136
*/
137-
export function getGPTSlotsForAdUnits(adUnitCodes: AdUnitCode[], getSlots = () => window.googletag.pubads().getSlots()): ByAdUnit<googletag.Slot[]> {
137+
export function getGPTSlotsForAdUnits(adUnitCodes: AdUnitCode[], getSlots = () => (window as any).googletag.pubads().getSlots()): ByAdUnit<any[]> {
138138
return getSlots().reduce((auToSlots, slot) => {
139139
Object.keys(auToSlots).filter(isAdUnitCodeMatchingSlot(slot))
140140
.forEach(au => auToSlots[au].push(slot));
@@ -177,7 +177,7 @@ type TargetingValueLists = TargetingMap<string[]>;
177177
type TargetingArray = ByAdUnit<TargetingValueLists[]>[];
178178

179179
type AdUnitPredicate = (adUnitCode: AdUnitCode) => boolean;
180-
export type SlotMatchingFn = (slot: googletag.Slot) => AdUnitPredicate;
180+
export type SlotMatchingFn = (slot: any) => AdUnitPredicate;
181181

182182
declare module './events' {
183183
interface Events {

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"rootDir": "./",
99
"outDir": "./dist/src/",
1010
"noImplicitAny": false,
11-
"allowJs": true,
11+
"allowJs": false,
1212
"checkJs": false,
1313
"types": [],
1414
"lib": ["es2019", "DOM"],

0 commit comments

Comments
 (0)