-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule
from @angular-devkit/schematics
should accept return type Promise<Tree>
#22783
Comments
This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list. You can find more details about the feature request process in our documentation. |
I'm currently working rxjs 7.5+ and my schematics build broke because of this dependency. "peerDependencies": {
"rxjs": "^6.5.3 || ^7.4.0",
"zone.js": "~0.11.4"
}, Taken from |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
Taking a quick look at this, it seems that the problem is more with mismatch between the schematics' |
…ing a `Promise` of `Tree` The `Rule` type has been updated to align with its intended functionality, allowing it to return a `Promise<Tree>`. Previously, this behavior was supported but not properly typed. Closes angular#22783
…ing a `Promise` of `Tree` The `Rule` type has been updated to align with its intended functionality, allowing it to return a `Promise<Tree>`. Previously, this behavior was supported but not properly typed. Closes angular#22783
🚀 Feature request
Rule
from@angular-devkit/schematics
should accept return typePromise<Tree>
Command (mark with an
x
)@angular-devkit/schematics
Description
The interface
Rule
from@angular-devkit/schematics
should accept the return typePromise<Tree>
for asynchronous schematics. Now it only acceptsObservable<Tree>
:angular-cli/packages/angular_devkit/schematics/src/engine/interface.ts
Lines 234 to 237 in 37a06a7
The current problem with
Rule
accepting onlyObservable<Tree>
it that it accepts only theObservable
from rxjs of a fixed version6.6.7
(at the moment of writing) which is hardcoded independencies
inpackage.json
of@angular-devkit/schematics
:angular-cli/packages/angular_devkit/schematics/package.json
Line 20 in c2737dd
Therefore, if I'm writing custom schematics in my repo, while having any slightly different version of
rxjs
installed, e.g.6.6.3
, then I get an error about incompatible variants of the interfaceSubscriber
- between my installed version innode_modules
and the fixed version fromnode_modules/@angular-devkit/core/node_modules/rxjs
(which is derived from the interfaceRule
)Example of custom schematics for minimal reproduction:
The error message in detail:
Describe the solution you'd like
Promise<Tree>
as a return type ofRule
Describe alternatives you've considered
Promise<Rule | void>
instead ofPromise<Tree>
rxjs
fromdependencies
topeerDependencies
inpackage.json
of@angular-devkit/schematics
and relax the version to^6.6.0
(but still.. what if somebody is using rxjs7 in their repo?)The text was updated successfully, but these errors were encountered: