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

Commit 2dbe674

Browse files
committed
fix(express-engine): RenderOptions is not assignable to object
Closes #1744
1 parent 0ebf846 commit 2dbe674

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

modules/express-engine/src/main.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,22 @@ export function ngExpressEngine(setupOptions: Readonly<NgSetupOptions>) {
4242
const engine = new CommonEngine(setupOptions.bootstrap, setupOptions.providers);
4343

4444
return function (filePath: string,
45-
options: Readonly<RenderOptions>,
45+
options: object,
4646
callback: (err?: Error | null, html?: string) => void) {
4747
try {
48-
if (!setupOptions.bootstrap && !options.bootstrap) {
48+
const renderOptions = { ...options } as RenderOptions;
49+
if (!setupOptions.bootstrap && !renderOptions.bootstrap) {
4950
throw new Error('You must pass in a NgModule or NgModuleFactory to be bootstrapped');
5051
}
5152

52-
const req = options.req;
53-
const res = options.res || req.res;
54-
55-
const renderOptions: RenderOptions = Object.assign({}, options);
53+
const req = renderOptions.req;
54+
const res = renderOptions.res || req.res;
5655

5756
renderOptions.url =
58-
options.url || `${req.protocol}://${(req.get('host') || '')}${req.originalUrl}`;
59-
renderOptions.document = options.document || getDocument(filePath);
57+
renderOptions.url || `${req.protocol}://${(req.get('host') || '')}${req.originalUrl}`;
58+
renderOptions.document = renderOptions.document || getDocument(filePath);
6059

61-
renderOptions.providers = options.providers || [];
60+
renderOptions.providers = renderOptions.providers || [];
6261
renderOptions.providers = renderOptions.providers.concat(getReqResProviders(req, res));
6362

6463
engine.render(renderOptions)

0 commit comments

Comments
 (0)