Skip to content
This repository was archived by the owner on Feb 17, 2024. It is now read-only.

Commit b13963f

Browse files
committed
📦 lint
1 parent f4fdb1f commit b13963f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/index.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export function universalExpressEngine(setupOptions: UniversalSetupOptions) {
6060
moduleRefPromise.then((moduleRef: NgModuleRef<{}>) => {
6161
handleModuleRef(moduleRef, callback, setupOptions);
6262
return moduleRef;
63-
}, (err) => callback(e));
63+
}, (err: any) => callback(err));
6464

6565
} catch (e) {
6666
callback(e);
@@ -94,7 +94,7 @@ function getDocument(filePath: string): string {
9494
/**
9595
* Handle the request with a given NgModuleRef
9696
*/
97-
function handleModuleRef(moduleRef: NgModuleRef<{}>, callback: Send, setupOptions: UniversalSetupOptions) {
97+
function handleModuleRef(moduleRef: NgModuleRef<{}>, callback: Send | any, setupOptions: UniversalSetupOptions) {
9898
const state = moduleRef.injector.get(PlatformState);
9999
const appRef = moduleRef.injector.get(ApplicationRef);
100100

@@ -104,25 +104,26 @@ function handleModuleRef(moduleRef: NgModuleRef<{}>, callback: Send, setupOption
104104
.subscribe((stable: boolean) => {
105105
try {
106106
if (!(<any>moduleRef).instance[setupOptions.universalOnInit]) {
107-
console.log('Universal Error: Please provide ' + setupOptions.universalOnInit + 'on the ngModule ' + moduleRef.name);
107+
console.log('Universal Error: Please provide ' + setupOptions.universalOnInit + 'on the ngModule ' + (<any>moduleRef).name);
108108
}
109109
(<any>moduleRef).instance[setupOptions.universalOnInit](moduleRef, setupOptions);
110110
} catch (e) {
111-
console.log('Universal Error', err);
111+
console.log('Universal Error', e);
112112
try {
113113
moduleRef.destroy();
114114
} catch (ee) {}
115-
callback(err);
115+
callback(e);
116116
return;
117117
}
118118

119119
try {
120120
moduleRef.destroy();
121121
} catch (eee) {}
122-
callback(null, state.renderToString());
122+
const html = state.renderToString();
123+
callback(null, html);
123124
return;
124125
},
125-
(err) => {
126+
(err: any) => {
126127
console.log('Universal Error', err);
127128
callback(err);
128129
});

0 commit comments

Comments
 (0)