Skip to content

Commit 812feac

Browse files
committed
refactor: simplify dynamic import type assertions and remove resolution mode hints
Avoid casting to `any`
1 parent 959953b commit 812feac

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

packages/angular/build/src/tools/vite/middlewares/ssr-middleware.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ export function createAngularSsrInternalMiddleware(
3737
// which must be processed by the runtime linker, even if they are not used.
3838
await import('@angular/compiler');
3939
const { writeResponseToNodeResponse, createWebRequestFromNodeRequest } = (await import(
40-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
41-
'@angular/ssr/node' as any
40+
'@angular/ssr/node' as string
4241
)) as typeof import('@angular/ssr/node', { with: { 'resolution-mode': 'import' } });
4342

4443
const { ɵgetOrCreateAngularServerApp } = (await server.ssrLoadModule('/main.server.mjs')) as {
@@ -88,8 +87,7 @@ export async function createAngularSsrExternalMiddleware(
8887
await import('@angular/compiler');
8988

9089
const { createWebRequestFromNodeRequest, writeResponseToNodeResponse } = (await import(
91-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
92-
'@angular/ssr/node' as any
90+
'@angular/ssr/node' as string
9391
)) as typeof import('@angular/ssr/node', { with: { 'resolution-mode': 'import' } });
9492

9593
return function angularSsrExternalMiddleware(

packages/angular/build/src/utils/check-port.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function checkPort(port: number, host: string): Promise<number> {
3939
}
4040

4141
(
42-
import('@inquirer/confirm' as any) as Promise<
42+
import('@inquirer/confirm' as string) as Promise<
4343
typeof import('@inquirer/confirm', { with: { 'resolution-mode': 'import' } })
4444
>
4545
)

packages/angular/build/src/utils/server-rendering/launch-server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export const DEFAULT_URL = new URL('http://ng-localhost/');
2121
export async function launchServer(): Promise<URL> {
2222
const { reqHandler } = await loadEsmModuleFromMemory('./server.mjs');
2323
const { createWebRequestFromNodeRequest, writeResponseToNodeResponse } = (await import(
24-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25-
'@angular/ssr/node' as any
24+
'@angular/ssr/node' as string
2625
)) as typeof import('@angular/ssr/node', { with: { 'resolution-mode': 'import' } });
2726

2827
if (!isSsrNodeRequestHandler(reqHandler) && !isSsrRequestHandler(reqHandler)) {

packages/angular/cli/src/command-builder/command-module.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import type {
1414
Argv,
1515
CamelCaseKey,
1616
CommandModule as YargsCommandModule,
17-
// Resolution mode is required due to CamelCaseKey missing from esm types
18-
} from 'yargs' with { 'resolution-mode': 'require' };
17+
} from 'yargs';
1918
import { Parser as yargsParser } from 'yargs/helpers';
2019
import { getAnalyticsUserId } from '../analytics/analytics';
2120
import { AnalyticsCollector } from '../analytics/analytics-collector';

0 commit comments

Comments
 (0)