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

TypeScript 2.7 breaks @types/lodash #959

Closed
shimks opened this issue Feb 5, 2018 · 11 comments
Closed

TypeScript 2.7 breaks @types/lodash #959

shimks opened this issue Feb 5, 2018 · 11 comments
Labels

Comments

@shimks
Copy link
Contributor

shimks commented Feb 5, 2018

Description/Steps to reproduce

Currently, a LoopBack4 app created by the CLI tool will not compile correctly due to compatibility issue with @types/lodash and TypeScript.

Fix

  • lock @loopback/build typescript version to 2.6

Side note

  • the package needs to be published; lb-mocha command in build current doesn't exist
  • there should be a way to essentially do an acceptance test of physically creating an app through CLI and then trying out npm t and npm start and making sure that they don't fail.

Comments

@shimks
Copy link
Contributor Author

shimks commented Feb 5, 2018

Closing since the issue seems to be fixed
EDIT: npm i -g @loopback/cli (updating the CLI tool) did it for me

@shimks shimks closed this as completed Feb 5, 2018
@bajtos
Copy link
Member

bajtos commented Feb 6, 2018

lock @loopback/build typescript version to 2.6

We should find a way how to keep using the lastest TypeScript version. For example, it may be enough to upgrade some of our @types/{module} dependencies. If not, then we may need to copy and fix the broken .d.ts file as a temporary fix - see e.g. packages/testlab/should-as-function.d.ts

@shimks
Copy link
Contributor Author

shimks commented Feb 6, 2018

Reopening since it doesn't seem to be affecting just the apps generated by the CLI @b-admike

@shimks shimks reopened this Feb 6, 2018
@b-admike
Copy link
Contributor

b-admike commented Feb 6, 2018

Yeah I was trying out https://github.com/raymondfeng/loopback4-example-di and this is what happened/ how I resolved it:

___________________    | ~/loopback/loopback4-example-di @ Biniams-MacBook-Pro (badmike)
| => npm i

> [email protected] prepare /Users/badmike/loopback/loopback4-example-di
> npm run build


> [email protected] build /Users/badmike/loopback/loopback4-example-di
> lb-tsc es2017

node_modules/@types/lodash/index.d.ts(12651,53): error TS2344: Type 'T' does not satisfy the constraint 'object'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `lb-tsc es2017`
npm ERR! Exit status 2
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/badmike/.strong-registry/pre-release.cache/_logs/2018-02-06T14_41_51_016Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prepare: `npm run build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] prepare 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/badmike/.strong-registry/pre-release.cache/_logs/2018-02-06T14_41_51_051Z-debug.log
___________________    | ~/loopback/loopback4-example-di @ Biniams-MacBook-Pro (badmike)
| => npm un -g typescript
removed 1 package in 0.111s
___________________    | ~/loopback/loopback4-example-di @ Biniams-MacBook-Pro (badmike)
| => rm -rf node_modules/
___________________    | ~/loopback/loopback4-example-di @ Biniams-MacBook-Pro (badmike)
| => npm i

> [email protected] prepare /Users/badmike/loopback/loopback4-example-di
> npm run build


> [email protected] build /Users/badmike/loopback/loopback4-example-di
> lb-tsc

added 388 packages in 29.702s

@bajtos
Copy link
Member

bajtos commented Feb 12, 2018

there should be a way to essentially do an acceptance test of physically creating an app through CLI and then trying out npm t and npm start and making sure that they don't fail.

See #932

@bajtos
Copy link
Member

bajtos commented Feb 12, 2018

@b-admike @shimks I am not able to reproduce this problem. I don't have any globally-installed version of typescript.

Using lb4 from the current master branch (e5a9ce8):

$ lb4
? Project name: foobar
? Project description: foobar
? Project root directory: foobar
? Application class name: FoobarApplication
? Select project build settings:  Enable tslint, Enable prettier, Enable mocha, Enable loopbackBuild
 [...]
$ cd foobar/
$ npm start

> [email protected] start /private/tmp/foobar
> npm run build && node .


> [email protected] build /private/tmp/foobar
> lb-tsc es2017

Server is running at http://127.0.0.1:3000
Try http://127.0.0.1:3000/ping

Strangely enough, I am seeing an older version of tsc installed in my project:

$ ./node_modules/.bin/tsc -v
Version 2.5.3

This looks like an issue in typescript-json-schema:

[email protected] /private/tmp/foobar
├─┬ @loopback/[email protected]
│ ├─┬ [email protected]
│ │ └─┬ [email protected]
│ │   └── [email protected]
│ └── [email protected]
└─┬ @loopback/[email protected]
  └─┬ @loopback/[email protected]
    └─┬ [email protected]
      └── [email protected]

However, it should not affect our use case, because we are invoking tsc via lb-tsc, which uses the correct version.

$ lb-tsc --version
Version 2.7.1

@virkt25
Copy link
Contributor

virkt25 commented Feb 12, 2018

Haven't run into this issue myself either. @b-admike have you tried updating @loopback/cli as per @shimks 's comment?

@aj-r
Copy link

aj-r commented Feb 16, 2018

Looks like this has been fixed in the latest version of lodash (4.14.103). Try running npm install -S @types/lodash@latest (or similar in yarn) with TS 2.7, and see if that fixes it.

@shimks
Copy link
Contributor Author

shimks commented Feb 16, 2018

I've been able to verify that builds from CLI generated apps no longer error out. @b-admike Could you also verify that your use case also builds correctly before the fix you applied?

@b-admike
Copy link
Contributor

Yeah it's good on my end as well!

@shimks
Copy link
Contributor Author

shimks commented Feb 20, 2018

Closing since the issue seems to have been fixed with the latest version of lodash. Thanks @aj-r for letting us know!

@shimks shimks closed this as completed Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants