You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Creating a fresh project and getting the following error in Development environment:
in [at-loader] ./ClientApp/boot-server.tsx:43:25
TS2345: Argument of type '{ html: string; globals: { initialReduxState: ApplicationState; }; }' is not assignable to parameter of type 'RenderToStringResult | RedirectResult | PromiseLike'.
Type '{ html: string; globals: { initialReduxState: ApplicationState; }; }' is not assignable to type 'PromiseLike'.
Property 'then' is missing in type '{ html: string; globals: { initialReduxState: ApplicationState; }; }'.
Same issue but on VS2017. Using dotnet run does successfully run the application however code changes are not reflected in the browser without total restarts of applications and so on. This error started for me when I tried an upgrade to Angular 4.0 not knowing the problems that would subsequently ensue.
Argument of type '(params: BootFuncParams) => Promise<{ html: string; globals: { [key: string]: any; styles: string...' is not assignable to parameter of type 'BootFunc'.
Type 'Promise<{ html: string; globals: { [key: string]: any; styles: string; title: string; meta: strin...' is not assignable to type 'Promise'.
Type '{ html: string; globals: { [key: string]: any; styles: string; title: string; meta: string; }; }' is not assignable to type 'RenderToStringResult'.
Property 'statusCode' is missing in type '{ html: string; globals: { [key: string]: any; styles: string; title: string; meta: string; }; }'.
params.domainTasks.then(() => {
resolve({
html: renderToString(app),
statusCode: 200,
globals: { initialReduxState: store.getState() }
});
}, reject); // Also propagate any errors back into the host application
The issue is that the RenderToStringResult type expect a statusCode field on it, and typescript is thus not able to implicitly duck type to that type when passed the object literal without it. By adding in the field it is fixed. Probably related to the npm push by @SteveSandersonMS a few hours ago of aspnet-prerendering.
@lee-alderdice Hi, the only difference is adding statusCode: 200 in at what is line 45 of boot-server assuming no other changes moving lines around in the file.
Activity
tonven commentedon May 4, 2017
Same issue here #917
lee-alderdice commentedon May 4, 2017
Same issue but on VS2017. Using dotnet run does successfully run the application however code changes are not reflected in the browser without total restarts of applications and so on. This error started for me when I tried an upgrade to Angular 4.0 not knowing the problems that would subsequently ensue.
abstract-christos commentedon May 4, 2017
same here with Angular 4
Argument of type '(params: BootFuncParams) => Promise<{ html: string; globals: { [key: string]: any; styles: string...' is not assignable to parameter of type 'BootFunc'.
Type 'Promise<{ html: string; globals: { [key: string]: any; styles: string; title: string; meta: strin...' is not assignable to type 'Promise'.
Type '{ html: string; globals: { [key: string]: any; styles: string; title: string; meta: string; }; }' is not assignable to type 'RenderToStringResult'.
Property 'statusCode' is missing in type '{ html: string; globals: { [key: string]: any; styles: string; title: string; meta: string; }; }'.
fplaten commentedon May 4, 2017
We had the same issue and downgraded the npm package to 2.0.3. This fixed it for us.
DanHarman commentedon May 4, 2017
Edit: Proper answer
The issue is that the RenderToStringResult type expect a statusCode field on it, and typescript is thus not able to implicitly duck type to that type when passed the object literal without it. By adding in the field it is fixed. Probably related to the npm push by @SteveSandersonMS a few hours ago of
aspnet-prerendering.lee-alderdice commentedon May 4, 2017
Hi @DanHarman. Would you mind posting a fuller boot-server file. I am only learning and finding it hard to update with these changes. Thanks so much.
DanHarman commentedon May 4, 2017
@lee-alderdice Hi, the only difference is adding
statusCode: 200in at what is line 45 of boot-server assuming no other changes moving lines around in the file.MarkPieszak commentedon May 4, 2017
You can revert to aspnet-prerendering 2.0.3 to fix it for now as well.
Make statusCode optional on RenderToStringResult. Fixes #917 and #918
SteveSandersonMS commentedon May 4, 2017
Sorry about that. I've just published
aspnet-prerendering2.0.5 which fixes this.