Skip to content

Commit 98b7df8

Browse files
committed
Add workaround for Bazel ts module resolution
1 parent 99db7ed commit 98b7df8

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/lib/schematics/utils/ast.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ export function addModuleImportToModule(
4848
throw new SchematicsException(`Module not found: ${modulePath}`);
4949
}
5050

51-
const changes = addImportToModule(moduleSource, modulePath, moduleName, src);
51+
// TODO(devversion): Cast to any because the Bazel typescript rules seem to incorrectly resolve
52+
// the the required TypeScript version for the @schematics/angular utility functions. Meaning
53+
// that is a type signature mismatch at compilation which is not valid.
54+
const changes = addImportToModule(moduleSource as any, modulePath, moduleName, src);
5255
const recorder = host.beginUpdate(modulePath);
5356

5457
changes.forEach((change) => {

src/lib/schematics/utils/build-component.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
6666
const relativePath = buildRelativePath(modulePath, componentPath);
6767
const classifiedName = strings.classify(`${options.name}Component`);
6868

69+
// TODO(devversion): Cast to any because the Bazel typescript rules seem to incorrectly resolve
70+
// the the required TypeScript version for the @schematics/angular utility functions. Meaning
71+
// that is a type signature mismatch at compilation which is not valid.
6972
const declarationChanges = addDeclarationToModule(
70-
source,
73+
source as any,
7174
modulePath,
7275
classifiedName,
7376
relativePath);
@@ -85,7 +88,12 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
8588
const source = readIntoSourceFile(host, modulePath);
8689
const exportRecorder = host.beginUpdate(modulePath);
8790

88-
const exportChanges = addExportToModule(source, modulePath,
91+
// TODO(devversion): Cast to any because the Bazel typescript rules seem to incorrectly resolve
92+
// the the required TypeScript version for the @schematics/angular utility functions. Meaning
93+
// that is a type signature mismatch at compilation which is not valid.
94+
const exportChanges = addExportToModule(
95+
source as any,
96+
modulePath,
8997
strings.classify(`${options.name}Component`),
9098
relativePath);
9199

@@ -102,8 +110,11 @@ function addDeclarationToNgModule(options: ComponentOptions): Rule {
102110
const source = readIntoSourceFile(host, modulePath);
103111
const entryComponentRecorder = host.beginUpdate(modulePath);
104112

113+
// TODO(devversion): Cast to any because the Bazel typescript rules seem to incorrectly resolve
114+
// the the required TypeScript version for the @schematics/angular utility functions. Meaning
115+
// that is a type signature mismatch at compilation which is not valid.
105116
const entryComponentChanges = addEntryComponentToModule(
106-
source,
117+
source as any,
107118
modulePath,
108119
strings.classify(`${options.name}Component`),
109120
relativePath);

0 commit comments

Comments
 (0)