Skip to content

Commit 33cb34c

Browse files
committed
Add workaround for Bazel ts module resolution
1 parent 6f56f01 commit 33cb34c

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
@@ -49,7 +49,10 @@ export function addModuleImportToModule(host: Tree, modulePath: string, moduleNa
4949
throw new SchematicsException(`Module not found: ${modulePath}`);
5050
}
5151

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

5558
changes.forEach((change) => {

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

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

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

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

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

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

0 commit comments

Comments
 (0)