Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: specify the type for handler #2976

Merged
merged 1 commit into from
May 27, 2019
Merged

fix: specify the type for handler #2976

merged 1 commit into from
May 27, 2019

Conversation

jannyHou
Copy link
Contributor

Fixes the following build error on my local:

packages/rest/src/router/external-express-routes.ts(53,34): error TS2345: Argument of type 'Handler' is not assignable to parameter of type 'Application'.
  Type 'Handler' is missing the following properties from type 'Application': init, defaultConfiguration, engine, set, and 61 more.
npm ERR! Darwin 17.7.0
npm ERR! argv "/Users/jannyhou/.nvm/versions/node/v10.15.3/bin/node" "/Users/jannyhou/node_modules/.bin/npm" "run" "build"
npm ERR! node v10.15.3
npm ERR! npm  v3.10.6
npm ERR! code ELIFECYCLE
npm ERR! @loopback/[email protected] build: `lb-tsc es2017 --outDir dist`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @loopback/[email protected] build script 'lb-tsc es2017 --outDir dist'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the @loopback/benchmark package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     lb-tsc es2017 --outDir dist
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs @loopback/benchmark
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls @loopback/benchmark
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jannyhou/2019/passport-strategy/loopback-next/benchmark/npm-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `node bin/run-lerna run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jannyhou/.strong-registry/official.cache/_logs/2019-05-27T02_24_01_852Z-debug.log

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

@jannyHou jannyHou merged commit 9e0119d into master May 27, 2019
this._staticRoutes.use(path, express.static(
rootDir,
options,
) as Application);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is problematic. The express.static() returns a RequestHandler, which is NOT an instance of Application. The original compilation error might be caused by something else.

raymondfeng added a commit that referenced this pull request May 28, 2019
raymondfeng added a commit that referenced this pull request May 28, 2019
@bajtos bajtos deleted the fix/express-type branch May 30, 2019 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants