Skip to content

Commit

Permalink
chore: mention experimental decorators and useDefineForClassFields: f…
Browse files Browse the repository at this point in the history
…alse
  • Loading branch information
inca committed May 27, 2024
1 parent e1e757b commit a4040b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mesh IoC
# [Mesh IoC

Powerful and lightweight alternative to Dependency Injection (DI) solutions like [Inversify](https://inversify.io/).

Expand All @@ -17,6 +17,16 @@ Mesh IoC solves the problem of dependency management of application services. It
- 🕵️‍♀️ Provides APIs for dependency analysis
- 🐓 🥚 Tolerates circular dependencies

## Prerequisites

Make sure `tsconfig.json` contains the following:

```
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"useDefineForClassFields": false,
```

## API Cheatsheet

```ts
Expand Down Expand Up @@ -393,6 +403,14 @@ Note: the important limitation of this approach is that `@dep` are not available

- Don't be too dogmatic about interface/implementation split. For example, if all class methods are its public interface, there is no point in splitting it into an "interface" and its single implementation (e.g. ` abstract Config` and `ConfigImpl`) — this provides close to zero practical value and contributes towards people disliking the OOP paradigm for its verbosity and cargo culting. Instead just bind the concrete class to itself.

## TypeScript Decorators

This library is designed to work with [TypeScript stage-2 Experimental Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html) and emitted metadata to facilitate some of the features.

TypeScript 5.0 implementes [stage-3 ECMAScript decorators](https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#decorators) which is largely incompatible with Mesh.

We have not yet looked at migrating to ECMAScript decorators, but it is likely that migrating to them will be a breaking change. For now, please stick with `experimentalDecorators: true` as mentioned in [prerequisited](#prerequisites).

## License

[ISC](https://en.wikipedia.org/wiki/ISC_license) © Boris Okunskiy
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "ES2020",
"target": "ES2023",

Check failure on line 3 in tsconfig.json

View workflow job for this annotation

GitHub Actions / test

Argument for '--target' option must be: 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext'.
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
Expand All @@ -12,6 +12,7 @@
"composite": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"useDefineForClassFields": false,
"lib": [
"ES2015"
],
Expand Down

0 comments on commit a4040b6

Please sign in to comment.