fix: align linker output with Angular TypeScript compiler#91
Merged
Brooooooklyn merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
92b0851 to
d60a641
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- fix `deps: null` to use `ɵɵgetInheritedFactory` instead of no-args constructor - fix `deps: 'invalid'` to emit `ɵɵinvalidFactory()` - add ForPipe flag (16) for Pipe dependency inject calls - fix `attribute: true` to use token as arg to `ɵɵinjectAttribute` - handle `token: null` deps with `ɵɵinvalidFactoryDep(index)` - fix `useClass != type` without deps to delegate to `useClass.ɵfac` - omit `providedIn` when null (matching TS behavior) - refactor `extract_deps_source` to take target param, generate correct inject function directly instead of fragile string replacement - only emit `standalone: false` (omit when true, matching TS default) - remove extra `type` property from `defineInjector` output - omit `declarations`/`imports`/`exports` from `defineNgModule` in AOT mode - add `id` support and `registerNgModuleType` IIFE side-effect for NgModules - fix `link_injectable` to use conditional factory pattern for useValue, useExisting, useFactory (with deps), and useClass (with deps) - fix `useFactory` without deps to wrap as `() => factory()` - fix `useClass === type` without deps to include `__ngFactoryType__` param - fix `link_class_metadata_async` to extract callback params and read decorators/ctorParameters/propDecorators from resolveMetadata return value Close #89 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d60a641 to
2505237
Compare
Member
Author
|
cursor review |
|
Skipping Bugbot: Unable to authenticate your request. Please make sure Bugbot is properly installed and configured for this repository. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

deps: nullto useɵɵgetInheritedFactoryinstead of no-args constructordeps: 'invalid'to emitɵɵinvalidFactory()attribute: trueto use token as arg toɵɵinjectAttributetoken: nulldeps withɵɵinvalidFactoryDep(index)useClass != typewithout deps to delegate touseClass.ɵfacprovidedInwhen null (matching TS behavior)extract_deps_sourceto take target param, generate correctinject function directly instead of fragile string replacement
standalone: false(omit when true, matching TS default)typeproperty fromdefineInjectoroutputdeclarations/imports/exportsfromdefineNgModulein AOT modeidsupport andregisterNgModuleTypeIIFE side-effect for NgModuleslink_injectableto use conditional factory pattern for useValue,useExisting, useFactory (with deps), and useClass (with deps)
useFactorywithout deps to wrap as() => factory()useClass === typewithout deps to include__ngFactoryType__paramlink_class_metadata_asyncto extract callback params and readdecorators/ctorParameters/propDecorators from resolveMetadata return value
Close #89
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Note
Medium Risk
Touches core linking logic for DI factories/injectables and NgModule/injector emission, which can change runtime behavior if mismatched. Risk is mitigated by extensive new regression tests covering the new edge cases.
Overview
Updates
ɵɵngDeclareFactorylinking to match Angular semantics fordeps: treatsdeps: nullas inherited (usesɵɵgetInheritedFactory),deps: 'invalid'asɵɵinvalidFactory(), emitsɵɵinvalidFactoryDep(index)fortoken: null, fixes@Attribute()handling to pass the deptoken, and generates the correct inject function/flags directly (including PipeForPipeflag16andɵɵdirectiveInjectvsɵɵinject).Reworks
ɵɵngDeclareInjectablelinking to omitprovidedInwhen unset/null and to use Angular’s conditional-factory pattern foruseValue,useExisting, anduseFactory/useClass(including delegatinguseClass != typetouseClass.ɵfacand wrappinguseFactorywithout deps as() => factory()).Adjusts emitted definitions to omit
standalonewhen it would betrue(only emitstandalone: false), removes the extratypefield fromdefineInjector, changesdefineNgModuleoutput to omitdeclarations/imports/exportsin AOT mode while addingidsupport viaregisterNgModuleTypeIIFE, and fixesɵɵngDeclareClassMetadataAsynclinking to derive callback params and metadata fromresolveMetadata’s returned object. Adds comprehensive tests for all of the above behaviors.Written by Cursor Bugbot for commit d60a641. This will update automatically on new commits. Configure here.