Skip to content

Commit bf764cd

Browse files
committed
Remove unnecessary casts
1 parent 5a5dbc3 commit bf764cd

8 files changed

Lines changed: 18 additions & 18 deletions

src/config-utils.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ test.serial(
12141214
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
12151215
codeScanningConfig: {
12161216
packs: ["some-custom-pack@1.0.0"],
1217-
} as UserConfig,
1217+
},
12181218
isDefaultBranch: true,
12191219
},
12201220
{
@@ -1464,7 +1464,7 @@ test.serial(
14641464
],
14651465
codeScanningConfig: {
14661466
"disable-default-queries": true,
1467-
} as UserConfig,
1467+
},
14681468
isDefaultBranch: true,
14691469
},
14701470
{
@@ -1483,7 +1483,7 @@ test.serial(
14831483
],
14841484
codeScanningConfig: {
14851485
packs: ["some-custom-pack@1.0.0"],
1486-
} as UserConfig,
1486+
},
14871487
isDefaultBranch: true,
14881488
},
14891489
{
@@ -1502,7 +1502,7 @@ test.serial(
15021502
],
15031503
codeScanningConfig: {
15041504
queries: [{ uses: "some-query.ql" }],
1505-
} as UserConfig,
1505+
},
15061506
isDefaultBranch: true,
15071507
},
15081508
{
@@ -1521,7 +1521,7 @@ test.serial(
15211521
],
15221522
codeScanningConfig: {
15231523
"query-filters": [{ include: { "security-severity": "high" } }],
1524-
} as UserConfig,
1524+
},
15251525
isDefaultBranch: true,
15261526
},
15271527
{
@@ -1590,7 +1590,7 @@ test.serial(
15901590
features: [Feature.OverlayAnalysis, Feature.OverlayAnalysisJavascript],
15911591
codeScanningConfig: {
15921592
packs: ["some-custom-pack@1.0.0"],
1593-
} as UserConfig,
1593+
},
15941594
isPullRequest: true,
15951595
},
15961596
{
@@ -1741,7 +1741,7 @@ test.serial(
17411741
],
17421742
codeScanningConfig: {
17431743
"disable-default-queries": true,
1744-
} as UserConfig,
1744+
},
17451745
isPullRequest: true,
17461746
},
17471747
{
@@ -1760,7 +1760,7 @@ test.serial(
17601760
],
17611761
codeScanningConfig: {
17621762
packs: ["some-custom-pack@1.0.0"],
1763-
} as UserConfig,
1763+
},
17641764
isPullRequest: true,
17651765
},
17661766
{
@@ -1779,7 +1779,7 @@ test.serial(
17791779
],
17801780
codeScanningConfig: {
17811781
queries: [{ uses: "some-query.ql" }],
1782-
} as UserConfig,
1782+
},
17831783
isPullRequest: true,
17841784
},
17851785
{
@@ -1798,7 +1798,7 @@ test.serial(
17981798
],
17991799
codeScanningConfig: {
18001800
"query-filters": [{ include: { "security-severity": "high" } }],
1801-
} as UserConfig,
1801+
},
18021802
isPullRequest: true,
18031803
},
18041804
{

src/config-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ async function getRawLanguagesInRepo(
331331
});
332332

333333
logger.debug(`Languages API response: ${JSON.stringify(response)}`);
334-
const result = Object.keys(response.data as Record<string, number>).map(
335-
(language) => language.trim().toLowerCase(),
334+
const result = Object.keys(response.data).map((language) =>
335+
language.trim().toLowerCase(),
336336
);
337337

338338
if (hasActionsWorkflows(sourceRoot)) {

src/debug-artifacts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export function getArtifactSuffix(matrix: string | undefined): string {
263263
try {
264264
const matrixObject = JSON.parse(matrix);
265265
if (json.isObject(matrixObject)) {
266-
for (const matrixKey of Object.keys(matrixObject as object).sort())
266+
for (const matrixKey of Object.keys(matrixObject).sort())
267267
suffix += `-${matrixObject[matrixKey]}`;
268268
} else {
269269
core.warning("User-specified `matrix` input is not an object.");

src/feature-flags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class OfflineFeatures implements FeatureEnablement {
386386
getFeatureConfig(feature: Feature): FeatureConfig {
387387
// Narrow the type to FeatureConfig to avoid type errors. To avoid unsafe use of `as`, we
388388
// check that the required properties exist using `satisfies`.
389-
return featureConfig[feature] satisfies FeatureConfig as FeatureConfig;
389+
return featureConfig[feature] satisfies FeatureConfig;
390390
}
391391

392392
/**

src/init-action-post-helper.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ async function testFailedSarifUpload(
601601
uploadFiles.resolves({
602602
sarifID: "42",
603603
statusReport: { raw_upload_size_bytes: 20, zipped_upload_size_bytes: 10 },
604-
} as uploadLib.UploadResult);
604+
});
605605
const waitForProcessing = sinon.stub(uploadLib, "waitForProcessing");
606606

607607
const features = [] as Feature[];

src/testing-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function wrapOutput(context: TestContext) {
8686
}
8787

8888
export function setupTests(test: TestFn<any>) {
89-
const typedTest = test as TestFn<TestContext>;
89+
const typedTest: TestFn<TestContext> = test;
9090

9191
typedTest.beforeEach((t) => {
9292
// Set an empty CodeQL object so that all method calls will fail

src/upload-sarif.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const postProcessAndUploadSarifMacro = test.macro({
6767
const analysisConfig = getAnalysisConfig(analysisKind);
6868
uploadPostProcessedFiles
6969
.withArgs(logger, sinon.match.any, analysisConfig, sinon.match.any)
70-
.resolves(expectedResult[analysisKind as AnalysisKind]?.uploadResult);
70+
.resolves(expectedResult[analysisKind]?.uploadResult);
7171
}
7272

7373
const fullSarifPaths = sarifFiles.map(toFullPath);

src/workflow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ async function testLanguageAliases(
422422
],
423423
},
424424
},
425-
} as Workflow,
425+
},
426426
codeql,
427427
);
428428

0 commit comments

Comments
 (0)