Skip to content

Commit 3c1cd67

Browse files
committed
ci: validate generated type declarations
1 parent 6db6262 commit 3c1cd67

32 files changed

Lines changed: 228 additions & 432 deletions

.github/workflows/pull-request.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,31 @@ jobs:
8484
name: npm-logs
8585
path: ~/.npm/_logs
8686

87+
test-types:
88+
name: 'Test Type Declarations'
89+
runs-on: ubuntu-latest
90+
steps:
91+
- name: Checkout
92+
uses: actions/checkout@v6
93+
94+
- name: NPM install
95+
uses: actions/setup-node@v6
96+
with:
97+
node-version: latest
98+
99+
- name: Run NPM CI
100+
run: npm ci
101+
102+
- name: Build and Test Type Declarations
103+
run: npm run test:types
104+
105+
- name: Archive npm failure logs
106+
uses: actions/upload-artifact@v6
107+
if: failure()
108+
with:
109+
name: npm-logs
110+
path: ~/.npm/_logs
111+
87112
# Only Core test requires bundle, but we want to make sure
88113
# that tests only run when the bundle is successfully built
89114
test-core:

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,31 @@ jobs:
7979
name: npm-logs
8080
path: ~/.npm/_logs
8181

82+
test-types:
83+
name: 'Test Type Declarations'
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v6
88+
89+
- name: NPM install
90+
uses: actions/setup-node@v6
91+
with:
92+
node-version: latest
93+
94+
- name: Run NPM CI
95+
run: npm ci
96+
97+
- name: Build and Test Type Declarations
98+
run: npm run test:types
99+
100+
- name: Archive npm failure logs
101+
uses: actions/upload-artifact@v6
102+
if: failure()
103+
with:
104+
name: npm-logs
105+
path: ~/.npm/_logs
106+
82107
# Only Core test requires bundle, but we want to make sure
83108
# that tests only run when the bundle is successfully built
84109
test-core:
@@ -222,6 +247,7 @@ jobs:
222247
- test-integrations-module-js-rollup
223248
- test-integrations-require-js
224249
- confirm-public-repo-master-branch
250+
- test-types
225251
steps:
226252
- name: Checkout development branch
227253
uses: actions/checkout@v6

.github/workflows/staging-step-1.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,31 @@ jobs:
9393
name: npm-logs
9494
path: ~/.npm/_logs
9595

96+
test-types:
97+
name: 'Test Type Declarations'
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v6
102+
103+
- name: NPM install
104+
uses: actions/setup-node@v6
105+
with:
106+
node-version: 24.x
107+
108+
- name: Run NPM CI
109+
run: npm ci
110+
111+
- name: Build and Test Type Declarations
112+
run: npm run test:types
113+
114+
- name: Archive npm failure logs
115+
uses: actions/upload-artifact@v6
116+
if: failure()
117+
with:
118+
name: npm-logs
119+
path: ~/.npm/_logs
120+
96121
# Only Core test requires bundle, but we want to make sure
97122
# that tests only run when the bundle is successfully built
98123
test-core:
@@ -236,6 +261,7 @@ jobs:
236261
- test-integrations-module-js-rollup
237262
- test-integrations-require-js
238263
- confirm-staging-branch
264+
- test-types
239265
steps:
240266
- name: Checkout development branch
241267
uses: actions/checkout@v6

DEFINITELY_TYPED_DRIFT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ native declarations without depending on `@types/mparticle__web-sdk`, while
2929
avoiding declarations for named runtime imports that the ESM bundle does not
3030
emit.
3131

32+
The generated `dist/types` output is intentionally not part of this PR's source
33+
diff. CI runs `npm run test:types`, which rebuilds declaration files from source
34+
before compiling the consumer fixtures against the generated package entry
35+
points.
36+
3237
## Public Type Ownership
3338

3439
- Added native public definitions for types previously supplied by

dist/mparticle.common.js

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mparticle.esm.js

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mparticle.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8051,16 +8051,14 @@ var mParticle = (function () {
80518051
};
80528052
},
80538053
createIdentityRequest: function createIdentityRequest(identityApiData, platform, sdkVendor, sdkVersion, deviceId, context, mpid) {
8054-
/** @type {import('./utils').Environment} */
8055-
var environment = mpInstance._Store.SDKConfig.isDevelopmentMode ? Constants.Environment.Development : Constants.Environment.Production;
80568054
var APIRequest = {
80578055
client_sdk: {
80588056
platform: platform,
80598057
sdk_vendor: sdkVendor,
80608058
sdk_version: sdkVersion
80618059
},
80628060
context: context,
8063-
environment: environment,
8061+
environment: mpInstance._Store.SDKConfig.isDevelopmentMode ? 'development' : 'production',
80648062
request_id: mpInstance._Helpers.generateUniqueId(),
80658063
request_timestamp_ms: new Date().getTime(),
80668064
previous_mpid: mpid || null,
@@ -8069,16 +8067,14 @@ var mParticle = (function () {
80698067
return APIRequest;
80708068
},
80718069
createModifyIdentityRequest: function createModifyIdentityRequest(currentUserIdentities, newUserIdentities, platform, sdkVendor, sdkVersion, context) {
8072-
/** @type {import('./utils').Environment} */
8073-
var environment = mpInstance._Store.SDKConfig.isDevelopmentMode ? Constants.Environment.Development : Constants.Environment.Production;
80748070
return {
80758071
client_sdk: {
80768072
platform: platform,
80778073
sdk_vendor: sdkVendor,
80788074
sdk_version: sdkVersion
80798075
},
80808076
context: context,
8081-
environment: environment,
8077+
environment: mpInstance._Store.SDKConfig.isDevelopmentMode ? 'development' : 'production',
80828078
request_id: mpInstance._Helpers.generateUniqueId(),
80838079
request_timestamp_ms: new Date().getTime(),
80848080
identity_changes: this.createIdentityChanges(currentUserIdentities, newUserIdentities)
@@ -8496,9 +8492,6 @@ var mParticle = (function () {
84968492
* Example: mParticle.Identity.getCurrentUser().getAllUserAttributes()
84978493
* @class mParticle.Identity.getCurrentUser()
84988494
*/
8499-
/**
8500-
* @returns {import('./identity-user-interfaces').IMParticleUser}
8501-
*/
85028495
this.mParticleUser = function (mpid, _isLoggedIn) {
85038496
var self = this;
85048497
return {
@@ -8833,9 +8826,6 @@ var mParticle = (function () {
88338826
* @class mParticle.Identity.getCurrentUser().getCart()
88348827
* @deprecated
88358828
*/
8836-
/**
8837-
* @returns {import('./identity-user-interfaces').mParticleUserCart}
8838-
*/
88398829
this.mParticleUserCart = function () {
88408830
return {
88418831
/**

dist/types/src/configAPIClient.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface IFilteringConsentRuleValues {
4545
values: IConsentRuleValue[];
4646
}
4747
export interface IConsentRuleValue {
48-
consentPurpose: string | number;
48+
consentPurpose: string;
4949
hasConsented: boolean;
5050
}
5151
export interface IConfigResponse {

dist/types/src/consent.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ConsentState, PrivacyConsentState } from './publicSdkTypes';
1+
import { ConsentState, PrivacyConsentState } from '@mparticle/web-sdk';
22
import { Dictionary } from './utils';
33
import { IMParticleUser } from './identity-user-interfaces';
44
import { IMParticleWebSDKInstance } from './mp-instance';
@@ -51,7 +51,7 @@ export interface IConsentStateV2DTO {
5151
ccpa?: ICCPAConsentStateV2DTO;
5252
}
5353
export interface IConsentRulesValues {
54-
consentPurpose: string | number;
54+
consentPurpose: string;
5555
hasConsented: boolean;
5656
}
5757
export interface IConsentRules {

dist/types/src/cookieSyncManager.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Dictionary } from './utils';
2-
import { MPID } from './publicSdkTypes';
2+
import { MPID } from '@mparticle/web-sdk';
33
import { IConsentRules } from './consent';
44
import { IMParticleWebSDKInstance } from './mp-instance';
55
export declare const DAYS_IN_MILLISECONDS: number;

0 commit comments

Comments
 (0)