Skip to content

Commit 3256761

Browse files
authored
Fix contentScopeFeatures TypeScript linting errors in inject scripts (#289)
1 parent 0b9715e commit 3256761

File tree

7 files changed

+11
-16
lines changed

7 files changed

+11
-16
lines changed

inject/android.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ function init () {
88
if (isGloballyDisabled(processedConfig)) {
99
return
1010
}
11-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
11+
1212
contentScopeFeatures.load({
1313
platform: processedConfig.platform
1414
})
15-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
15+
1616
contentScopeFeatures.init(processedConfig)
1717

1818
// Not supported:

inject/apple.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ function init () {
88
if (isGloballyDisabled(processedConfig)) {
99
return
1010
}
11-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
11+
1212
contentScopeFeatures.load({
1313
platform: processedConfig.platform
1414
})
15-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
15+
1616
contentScopeFeatures.init(processedConfig)
1717

1818
// Not supported:

inject/chrome-mv3.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { isTrackerOrigin } from '../src/trackers'
44

55
const secret = (crypto.getRandomValues(new Uint32Array(1))[0] / 2 ** 32).toString().replace('0.', '')
66

7-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
87
contentScopeFeatures.load({
98
platform: {
109
name: 'extension'
@@ -21,13 +20,11 @@ window.addEventListener(secret, ({ detail: message }) => {
2120

2221
switch (message.type) {
2322
case 'update':
24-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
2523
contentScopeFeatures.update(message)
2624
break
2725
case 'register':
2826
if (message.argumentsObject) {
2927
message.argumentsObject.messageSecret = secret
30-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
3128
contentScopeFeatures.init(message.argumentsObject)
3229
}
3330
break

inject/integration.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function mergeDeep (target, ...sources) {
7070
async function init () {
7171
const topLevelUrl = getTopLevelURL()
7272
const processedConfig = generateConfig()
73-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
73+
7474
await contentScopeFeatures.load({
7575
platform: processedConfig.platform
7676
})
@@ -79,7 +79,6 @@ async function init () {
7979
setStatus('loaded')
8080

8181
if (!topLevelUrl.searchParams.has('wait-for-init-args')) {
82-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
8382
await contentScopeFeatures.init(processedConfig)
8483
setStatus('initialized')
8584
return
@@ -90,7 +89,6 @@ async function init () {
9089
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
9190
const merged = mergeDeep(processedConfig, evt.detail)
9291
// init features
93-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
9492
await contentScopeFeatures.init(merged)
9593

9694
// set status to initialized so that tests can resume

inject/mozilla.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function randomString () {
1717
}
1818

1919
function init () {
20-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
2120
contentScopeFeatures.load({
2221
platform: {
2322
name: 'extension'
@@ -50,14 +49,12 @@ function init () {
5049
})
5150
}
5251
message.messageSecret = messageSecret
53-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
5452
contentScopeFeatures.init(message)
5553
})
5654

5755
chrome.runtime.onMessage.addListener((message) => {
5856
// forward update messages to the embedded script
5957
if (message && message.type === 'update') {
60-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
6158
contentScopeFeatures.update(message)
6259
}
6360
})
@@ -71,7 +68,6 @@ function init () {
7168
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
7269
chrome.runtime.sendMessage(m && m.detail, response => {
7370
const msg = { func: messageType, response }
74-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
7571
contentScopeFeatures.update({ detail: msg })
7672
})
7773
})

inject/windows.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ function init () {
88
if (isGloballyDisabled(processedConfig)) {
99
return
1010
}
11-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
11+
1212
contentScopeFeatures.load({
1313
platform: processedConfig.platform
1414
})
1515

16-
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
1716
contentScopeFeatures.init(processedConfig)
1817

1918
// Not supported:

src/globals.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ declare function exportFunction(fn: Function, desc: object, out: object): void;
33
declare function exportFunction(fn: Function, desc: object): void;
44
declare function cloneInto(fn: object, desc: object, out: object): void;
55
declare function cloneInto(fn: object, desc: object): void;
6+
declare namespace contentScopeFeatures {
7+
function init(args: Object): void;
8+
function load(args: Object): void;
9+
function update(args: Object): void;
10+
}

0 commit comments

Comments
 (0)