Skip to content

fix(injectable): don't default providedIn to 'root' when not specified#194

Merged
Brooooooklyn merged 1 commit intovoidzero-dev:mainfrom
ashley-hunter:fix/injectable-no-default-provided-in
Mar 30, 2026
Merged

fix(injectable): don't default providedIn to 'root' when not specified#194
Brooooooklyn merged 1 commit intovoidzero-dev:mainfrom
ashley-hunter:fix/injectable-no-default-provided-in

Conversation

@ashley-hunter
Copy link
Copy Markdown
Contributor

Summary

  • @Injectable() and @Injectable({}) no longer incorrectly default providedIn to 'root'
  • When providedIn is not explicitly specified, it is now omitted entirely, matching Angular's actual compiler behavior
  • Confirmed by the official Angular compliance tests (e.g. injectable_factory.ts expects no providedIn field in output)

Test plan

  • Updated unit tests in decorator.rs to assert provided_in.is_none() for bare @Injectable() and @Injectable({})
  • Updated integration test in transform.rs to verify providedIn is absent in compiled output
  • All 2,303 tests pass (including 987 compliance tests)

@Injectable() and @Injectable({}) were incorrectly defaulting providedIn
to 'root'. Angular's actual behavior is to omit providedIn entirely when
it's not explicitly specified, as confirmed by the official compliance tests.
@Brooooooklyn Brooooooklyn merged commit db8978f into voidzero-dev:main Mar 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants