Akita: [dependencies] tslib >= 1.7.0 < 2

Created on 8 Jul 2020  路  11Comments  路  Source: datorama/akita

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

The version dependency of tslib for akita is < 2.

Expected behavior

Is it possible to use it with the version 2.0.0?
I am wondering if this is still on purpose due to an incompatibility or if you could simply update it to allow to be compatible with the version 2.0.0.

What is the motivation / use case for changing the behavior?

Upgrading to Angular 10 on my project with the CLI throw an error.
Using the flag force allow nevertheless to update the dependency.

Note that even if Akita dependency seems to be incompatible with tslib I already have the 2.0.0 version and everything seems fine.

Example

This command:
ng update @datorama/akita @datorama/akita-cli @datorama/akita-ngdevtools

Produce this error:

Package "@datorama/akita-ngdevtools" has an incompatible peer dependency to "tslib" (requires "^1.10.0", would install "2.0.0")
Package "@datorama/akita" has an incompatible peer dependency to "tslib" (requires ">= 1.7.0 < 2", would install "2.0.0")

Environment


Angular version: 10.0.2
discussion

Most helpful comment

@xbaun can we do sth about this? Akita seems to work fine with tslib v2, TS v4 and Angular v10.1, but the peer dependency warning is pretty annoying. Maybe you could release a new majore version which depends on tslib v2 and TS > 3.9 ?

All 11 comments

@xbaun what do u think?

It seems that typescript must be upgraded to >3.8, to use tslib 2.0.0: https://github.com/microsoft/tslib/releases/tag/2.0.0

By requiring tslib 2.0.0 or higher we will probably break current projects based on older ts versions. Best option would be to compile Akita without --importHelpers flag, thus directly generating the helper functions and removing the tslib peer dependency.

@xbaun thank you for the insight.
If you do not plan to change the compilation method is it still required to disallow tslib on 2.0.0 version?
I am not sure, but I think that if you change the restriction to higher version it will not force to download the 2.0.0 since it will meet the >= 1.7.0 range for older versions and also avoid this error.
Also, if this was mentioned in the documentation for older versions that tslib should be set below the 2.0.0 version it would avoid potential mistakes when upgrading.
What do you think? Thanks.

I am not sure, but I think that if you change the restriction to higher version it will not force to download the 2.0.0 since it will meet the >= 1.7.0 range for older versions and also avoid this error.

The problem would be if Akita is compiled with a ts version lower than 3.9 (what is currently the case), it would require a tslib version < 2.0.0 to be installed which isn't compatible to 2.0.0 because of breaking changes in the helper functions. So if a project using Akita is relaying on tslib >= 2.0.0 (thus a newer ts version), then Akita would probably break by importing the wrong tslib version expecting the old helper functions. And the other way around.

So I would enable inlining the helper functions so that the dependency to any specific tslib version is removed. Projects using Akita can then choose any ts/tslib version they need.

Any update on this?

Hello,

As state by @C0ZEN, if you force the update angular 10 and akita are working nice together.
But according to @xbaun, it seems it should not work.

How could we explain this ?

@oliveti not work with older versions only.

@C0ZEN, really ? I'm currently developing a project with angular 10 and akita and I did not notice issues so far.

@oliveti this issue (which is not a bug but a feature-request) is only possible when you have tslib on 2.X.X on your project and you use Akita which requires > 2.

@xbaun can we do sth about this? Akita seems to work fine with tslib v2, TS v4 and Angular v10.1, but the peer dependency warning is pretty annoying. Maybe you could release a new majore version which depends on tslib v2 and TS > 3.9 ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bruceharrison1984 picture bruceharrison1984  路  6Comments

eitanfr picture eitanfr  路  4Comments

DmitryEfimenko picture DmitryEfimenko  路  6Comments

twittwer picture twittwer  路  7Comments

NathanAlcantara picture NathanAlcantara  路  4Comments