Skip to content

Commit 7bfe58e

Browse files
clydinalan-agius4
authored andcommitted
refactor(@ngtools/webpack): avoid exposing internal types in public API
The `AngularPluginSymbol` and `FileEmitterCollection` types are not intended to be exported for use within the public API of the package.
1 parent cb1db78 commit 7bfe58e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/ngtools/webpack/src/ivy/loader.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,18 @@
77
*/
88

99
import * as path from 'path';
10+
import type { LoaderContext } from 'webpack';
1011
import { AngularPluginSymbol, FileEmitterCollection } from './symbol';
1112

12-
export function angularWebpackLoader(
13-
this: import('webpack').LoaderContext<unknown> & {
14-
[AngularPluginSymbol]?: FileEmitterCollection;
15-
},
16-
content: string,
17-
map: string,
18-
) {
13+
export function angularWebpackLoader(this: LoaderContext<unknown>, content: string, map: string) {
1914
const callback = this.async();
2015
if (!callback) {
2116
throw new Error('Invalid webpack version');
2217
}
2318

24-
const fileEmitter = this[AngularPluginSymbol];
19+
const fileEmitter = (
20+
this as LoaderContext<unknown> & { [AngularPluginSymbol]?: FileEmitterCollection }
21+
)[AngularPluginSymbol];
2522
if (!fileEmitter || typeof fileEmitter !== 'object') {
2623
if (this.resourcePath.endsWith('.js')) {
2724
// Passthrough for JS files when no plugin is used

0 commit comments

Comments
 (0)