Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Error on fresh project #918

Closed
Closed

Description

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; }; }'.

Activity

  1. tonven commented on May 4, 2017

    @tonven

    Same issue here #917

  2. lee-alderdice commented on May 4, 2017

    @lee-alderdice

    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.

  3. abstract-christos commented on May 4, 2017

    @abstract-christos

    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; }; }'.

  4. fplaten commented on May 4, 2017

    @fplaten

    We had the same issue and downgraded the npm package to 2.0.3. This fixed it for us.

  5. DanHarman commented on May 4, 2017

    @DanHarman
    Contributor

    Edit: Proper answer

                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.

  6. lee-alderdice commented on May 4, 2017

    @lee-alderdice

    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.

  7. DanHarman commented on May 4, 2017

    @DanHarman
    Contributor

    @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.

  8. MarkPieszak commented on May 4, 2017

    @MarkPieszak
    Contributor

    You can revert to aspnet-prerendering 2.0.3 to fix it for now as well.

  9. SteveSandersonMS commented on May 4, 2017

    @SteveSandersonMS
    Member

    Sorry about that. I've just published aspnet-prerendering 2.0.5 which fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions