Skip to content

Conversation

@Evanion
Copy link
Member

@Evanion Evanion commented Jun 27, 2025

This PR modernizes NexusDI by introducing native decorator metadata support and simplifying the module API:

  • Native Decorator Metadata: Migrates from reflect-metadata to the new ECMAScript/TypeScript standard using Symbol.metadata. NexusDI now works out-of-the-box with TypeScript 5.2+ and no longer requires reflect-metadata as a dependency or import.
  • Unified Module API: Merges the services and providers arrays in module definitions into a single providers array, reducing boilerplate and making module configuration more intuitive.
  • Polyfill Included: NexusDI provides a built-in polyfill for Symbol.metadata for environments that do not yet support it natively.
  • Documentation & Examples: Updates documentation and code examples to reflect these changes and guide users through migration.

Type of Change

  • Breaking change (removes reflect-metadata and changes module API)
  • New feature (native decorator metadata support)
  • Documentation update

Migration Steps

  1. Upgrade to TypeScript 5.2+.
  2. Remove all imports of reflect-metadata.
  3. Update tsconfig.json:
    • Remove emitDecoratorMetadata
    • Ensure experimentalDecorators is enabled
    • (Optional) useDefineForClassFields should be enabled (default in TS 5.2+)
  4. Update modules: Merge services and providers into a single providers array.

Checklist

  • Code follows style guidelines
  • All tests pass locally
  • Documentation is updated
  • PR description clearly describes the changes

✨ May the dependencies be with you!

Evanion added 10 commits June 27, 2025 13:54
We have now migrated the library to use native decorators instead of reflect-metadata

BREAKING CHANGE: deprecates reflect-metadata in favor of native decorator metadata

#20
the services and providers arrays in modules have now been merged to a single prviders array. The
still work the same though. it's just simpler with less API

BREAKING CHANGE: services array removed

#20
@Evanion Evanion linked an issue Jun 27, 2025 that may be closed by this pull request
@Evanion Evanion added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 27, 2025
@Evanion Evanion merged commit e72e18b into main Jun 27, 2025
5 of 6 checks passed
@Evanion Evanion deleted the 20-feature-native-decorator-metadata-symbolmetadata branch June 27, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Native Decorator Metadata (Symbol.metadata)

2 participants