boot-server.tsx no longer compiles with TypeScript 2.4 (React + Redux template) #664

Closed
opened 2025-08-09 17:17:10 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @chris-nissen on 6/14/2017

Title

boot-server.tsx no longer compiles with TypeScript 2.4 (React + Redux template)

Functional impact

When webpacking in prod env mode, projects will fail TypeScript compilation. I'm not sure if any of the other templates are affected, but I expect they would be.

Minimal repro steps

  1. dotnet new reactredux
  2. Update the version of typescript to "2.4.0" in package.json
  3. npm install
  4. node node_modules/webpack/bin/webpack.js --env.prod

Expected result

Successful compilation.

Actual result

TS2345: Argument of type '(params: BootFuncParams) => Promise' is not assignable to parameter of type 'BootFunc'.
Type 'Promise' is not assignable to type 'Promise'.
Type 'RenderResult' is not assignable to type 'RenderToStringResult'.
Type 'RedirectResult' is not assignable to type 'RenderToStringResult'.
Property 'html' is missing in type 'RedirectResult'.

Further technical details

I think this can be fixed by updating the BootFunc interface like so:

interface BootFunc {
    (params: BootFuncParams): Promise<RenderToStringResult | RedirectResult>;
}
*Originally created by @chris-nissen on 6/14/2017* ### Title boot-server.tsx no longer compiles with TypeScript 2.4 (React + Redux template) ### Functional impact When webpacking in prod env mode, projects will fail TypeScript compilation. I'm not sure if any of the other templates are affected, but I expect they would be. ### Minimal repro steps 1. dotnet new reactredux 2. Update the version of typescript to "2.4.0" in package.json 3. npm install 4. node node_modules/webpack/bin/webpack.js --env.prod ### Expected result Successful compilation. ### Actual result TS2345: Argument of type '(params: BootFuncParams) => Promise<RenderResult>' is not assignable to parameter of type 'BootFunc'. Type 'Promise<RenderResult>' is not assignable to type 'Promise<RenderToStringResult>'. Type 'RenderResult' is not assignable to type 'RenderToStringResult'. Type 'RedirectResult' is not assignable to type 'RenderToStringResult'. Property 'html' is missing in type 'RedirectResult'. ### Further technical details I think this can be fixed by updating the BootFunc interface like so: ``` interface BootFunc { (params: BootFuncParams): Promise<RenderToStringResult | RedirectResult>; } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#664
No description provided.