Skip to content

Commit 59a1502

Browse files
jbedardclydin
authored andcommitted
build: fix typescript compilation errors
1 parent 32855b9 commit 59a1502

22 files changed

+57
-55
lines changed

tests/legacy-cli/e2e/setup/010-local-publish.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { execWithEnv, extractNpmEnv } from '../utils/process';
33
import { isPrereleaseCli } from '../utils/project';
44

55
export default async function () {
6-
const testRegistry = getGlobalVariable('package-registry');
6+
const testRegistry: string = getGlobalVariable('package-registry');
77
await execWithEnv(
88
'npm',
99
[

tests/legacy-cli/e2e/setup/100-global-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default async function () {
77
return;
88
}
99

10-
const testRegistry = getGlobalVariable('package-registry');
10+
const testRegistry: string = getGlobalVariable('package-registry');
1111

1212
// Install global Angular CLI.
1313
await silentNpm('install', '--global', '@angular/cli', `--registry=${testRegistry}`);

tests/legacy-cli/e2e/setup/300-log-environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default async function () {
1010
return;
1111
}
1212

13-
console.log(` ${envName}: ${process.env[envName].replace(/[\n\r]+/g, '\n ')}`);
13+
console.log(` ${envName}: ${process.env[envName]!.replace(/[\n\r]+/g, '\n ')}`);
1414
});
1515

1616
await node('--version');

tests/legacy-cli/e2e/setup/500-create-project.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ export default async function () {
1717
process.chdir(argv.reuse);
1818
await gitClean();
1919
} else {
20-
const extraArgs = [];
21-
2220
// Ensure local test registry is used when outside a project
2321
await setNPMConfigRegistry(true);
2422

25-
await ng('new', 'test-project', '--skip-install', ...extraArgs);
23+
await ng('new', 'test-project', '--skip-install');
2624
await expectFileToExist(join(process.cwd(), 'test-project'));
2725
process.chdir('./test-project');
2826

tests/legacy-cli/e2e/tests/build/build-app-shell-with-schematic.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ export default async function () {
1212

1313
const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots'];
1414
if (isSnapshotBuild) {
15-
const packagesToInstall = [];
15+
const packagesToInstall: string[] = [];
1616
await updateJsonFile('package.json', (packageJson) => {
1717
const dependencies = packageJson['dependencies'];
1818
// Iterate over all of the packages to update them to the snapshot version.
19-
for (const [name, version] of Object.entries(snapshots.dependencies)) {
19+
for (const [name, version] of Object.entries(
20+
snapshots.dependencies as { [p: string]: string },
21+
)) {
2022
if (name in dependencies && dependencies[name] !== version) {
2123
packagesToInstall.push(version);
2224
}

tests/legacy-cli/e2e/tests/build/platform-server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export default async function () {
1212

1313
const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots'];
1414
if (isSnapshotBuild) {
15-
const packagesToInstall = [];
15+
const packagesToInstall: string[] = [];
1616
await updateJsonFile('package.json', (packageJson) => {
1717
const dependencies = packageJson['dependencies'];
1818
// Iterate over all of the packages to update them to the snapshot version.
19-
for (const [name, version] of Object.entries(snapshots.dependencies)) {
19+
for (const [name, version] of Object.entries<string>(snapshots.dependencies)) {
2020
if (name in dependencies && dependencies[name] !== version) {
2121
packagesToInstall.push(version);
2222
}

tests/legacy-cli/e2e/tests/build/prod-build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default async function () {
3939
}
4040

4141
const indexContent = await readFile('dist/test-project/index.html');
42-
const mainPath = indexContent.match(/src="(main\.[0-9a-zA-Z]{0,32}\.js)"/)[1];
42+
const mainPath = indexContent.match(/src="(main\.[0-9a-zA-Z]{0,32}\.js)"/)![1];
4343

4444
// Content checks
4545
await expectFileToMatch(`dist/test-project/${mainPath}`, bootstrapRegExp);

tests/legacy-cli/e2e/tests/commands/add/add-pwa.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export default async function () {
5353

5454
// It should correctly generate assetGroups and include at least one URL in each group.
5555
const ngswJson = JSON.parse(await readFile(ngswPath));
56-
const assetGroups = ngswJson.assetGroups.map(({ name, urls }) => ({
56+
// @ts-ignore
57+
const assetGroups: any[] = ngswJson.assetGroups.map(({ name, urls }) => ({
5758
name,
5859
urlCount: urls.length,
5960
}));

tests/legacy-cli/e2e/tests/i18n/ivy-localize-basehref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ng } from '../../utils/process';
1111
import { updateJsonFile } from '../../utils/project';
1212
import { externalServer, langTranslations, setupI18nConfig } from './setup';
1313

14-
const baseHrefs = {
14+
const baseHrefs: { [l: string]: string } = {
1515
'en-US': '/en/',
1616
fr: '/fr-FR/',
1717
de: '',
@@ -59,7 +59,7 @@ export default async function () {
5959
await ng('e2e', `--configuration=${lang}`, '--port=0');
6060

6161
// Execute Application E2E tests for a production build without dev server
62-
const server = externalServer(outputPath, baseHrefs[lang] || '/');
62+
const server = externalServer(outputPath, (baseHrefs[lang] as string) || '/');
6363
try {
6464
await ng(
6565
'e2e',

tests/legacy-cli/e2e/tests/i18n/ivy-localize-hashes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default async function () {
2727
continue;
2828
}
2929

30-
hashes.set(`${lang}/${match.groups.name}`, match.groups.hash);
30+
hashes.set(`${lang}/${match!.groups!.name}`, match!.groups!.hash);
3131
}
3232
}
3333

@@ -48,12 +48,12 @@ export default async function () {
4848
continue;
4949
}
5050

51-
const id = `${lang}/${match.groups.name}`;
51+
const id = `${lang}/${match!.groups!.name}`;
5252
const hash = hashes.get(id);
5353
if (!hash) {
5454
throw new Error('Unexpected output entry: ' + id);
5555
}
56-
if (hash === match.groups.hash) {
56+
if (hash === match!.groups!.hash) {
5757
throw new Error('Hash value did not change for entry: ' + id);
5858
}
5959

0 commit comments

Comments
 (0)