Skip to content

Commit 5dcb390

Browse files
committed
fix(core): fixes ts types, added missing import
1 parent afdd2bd commit 5dcb390

4 files changed

Lines changed: 29 additions & 31 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngxf",
3-
"version": "6.0.3",
3+
"version": "6.0.4",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",

projects/platform/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ngxf/platform",
3-
"version": "6.0.3",
3+
"version": "6.0.4",
44
"description": "NGXF - Non-State Management for Angular",
55
"keywords": [
66
"non-ngxs",
@@ -37,9 +37,9 @@
3737
},
3838
"homepage": "https://github.com/ngxf/platform",
3939
"peerDependencies": {
40-
"@angular/common": "^6.0.0-rc.0 || ^6.0.0",
41-
"@angular/core": "^6.0.0-rc.0 || ^6.0.0",
42-
"@angular/router": "^6.0.0-rc.0 || ^6.0.0",
40+
"@angular/common": "^6.0.0-rc.0 || ^6.0.0 || ^7.0.0",
41+
"@angular/core": "^6.0.0-rc.0 || ^6.0.0 || ^7.0.0",
42+
"@angular/router": "^6.0.0-rc.0 || ^6.0.0 || ^7.0.0",
4343
"rxjs": ">=6.0.0 || ^5.6.0-forward-compat.4"
4444
}
45-
}
45+
}

projects/platform/src/lib/directives/async.directive.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface SubscriptionStrategy {
1414
}
1515

1616
class ObservableStrategy implements SubscriptionStrategy {
17-
createSubscription(async: ObservableOrPromise<any>, next: any, error: any, complete: any): SubscriptionLike {
17+
createSubscription(async: Observable<any>, next: any, error: any, complete: any): SubscriptionLike {
1818
return async.subscribe(next, error, complete);
1919
}
2020

@@ -26,8 +26,14 @@ class ObservableStrategy implements SubscriptionStrategy {
2626
}
2727

2828
class PromiseStrategy implements SubscriptionStrategy {
29-
createSubscription(async: Observable<any> | Promise<any>, next: any, error: any, complete: any): Promise<any> {
30-
return async.then(next, error).finally(complete);
29+
createSubscription(async: Promise<any>, next: any, error: any, complete: any): Promise<any> {
30+
const promise = async.then(next, error);
31+
32+
if ('finally' in promise) {
33+
return (promise as any).finally(complete);
34+
}
35+
36+
return promise;
3137
}
3238

3339
dispose(subscription: Promise<any>): void {}
@@ -97,7 +103,7 @@ export class AsyncDirective implements OnChanges, OnDestroy {
97103
}
98104
}
99105

100-
private subscribe(async: ObservableOrPromise<async>) {
106+
private subscribe(async: ObservableOrPromise<any>) {
101107
this.strategy = resolveStrategy(async);
102108
this.subscription = this.strategy.createSubscription(
103109
async,
Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
11
import { NgModule } from '@angular/core';
2-
import {
3-
HttpDirective,
4-
RouteDirective,
5-
InitDirective,
6-
TimeoutDirective,
7-
ComposeDirective,
8-
ReturnDirective,
9-
CookiesDirective
10-
} from './directives';
2+
import { AsyncDirective, ComposeDirective, CookiesDirective, HttpDirective, InitDirective, ReturnDirective, RouteDirective, TimeoutDirective } from './directives';
113

124
const DIRECTIVES = [
13-
HttpDirective,
14-
RouteDirective,
15-
InitDirective,
16-
TimeoutDirective,
17-
ComposeDirective,
18-
ReturnDirective,
19-
CookiesDirective
5+
AsyncDirective,
6+
ComposeDirective,
7+
CookiesDirective,
8+
HttpDirective,
9+
InitDirective,
10+
ReturnDirective,
11+
RouteDirective,
12+
TimeoutDirective
2013
];
2114

2215
@NgModule({
23-
imports: [],
24-
declarations: [DIRECTIVES],
25-
exports: [DIRECTIVES]
16+
imports: [],
17+
declarations: [ DIRECTIVES ],
18+
exports: [ DIRECTIVES ]
2619
})
27-
export class NgxfModule {
28-
}
20+
export class NgxfModule {}

0 commit comments

Comments
 (0)