typed-ember / ember-cli-typescript

Use TypeScript in your Ember.js apps!
https://docs.ember-cli-typescript.com
MIT License
363 stars 99 forks source link

Ember hangs after fresh install of ember-cli-typescript@1.3.1 #217

Closed mschorsch closed 6 years ago

mschorsch commented 6 years ago

After a fresh install of this addon, ember build hangs infinitely.

Steps to reproduce

  1. npm install -g ember-cli@3.1.4
  2. ember new ember-test-ts
  3. ember install ember-cli-typescript@1.3.1
  4. ember build

=> This leads to the following failure node_modules/@types/ember/index.d.ts(14,23): error TS2688: Cannot find type definition file for 'handlebars.

I've could reproduce this failure on Window 7 and Ubuntu 16.04 LTS (Node 8.11.2 LTS).

{
  "name": "ember-test-ts",
  "version": "0.0.0",
  "private": true,
  "description": "Small description for ember-test-ts goes here",
  "license": "MIT",
  "author": "",
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "repository": "",
  "scripts": {
    "build": "ember build",
    "lint:js": "eslint ./*.js app blueprints config lib server tests",
    "start": "ember serve",
    "test": "ember test"
  },
  "devDependencies": {
    "@types/ember": "^2.8.25",
    "@types/ember-data": "^2.14.17",
    "@types/ember-qunit": "^3.0.2",
    "@types/ember-test-helpers": "^0.7.1",
    "@types/ember-testing-helpers": "0.0.3",
    "@types/qunit": "^2.5.1",
    "@types/rsvp": "^4.0.1",
    "broccoli-asset-rev": "^2.4.5",
    "ember-ajax": "^3.0.0",
    "ember-cli": "~3.1.4",
    "ember-cli-app-version": "^3.0.0",
    "ember-cli-babel": "^6.6.0",
    "ember-cli-dependency-checker": "^2.0.0",
    "ember-cli-eslint": "^4.2.1",
    "ember-cli-htmlbars": "^2.0.1",
    "ember-cli-htmlbars-inline-precompile": "^1.0.0",
    "ember-cli-inject-live-reload": "^1.4.1",
    "ember-cli-qunit": "^4.1.1",
    "ember-cli-shims": "^1.2.0",
    "ember-cli-sri": "^2.1.0",
    "ember-cli-typescript": "^1.3.1",
    "ember-cli-uglify": "^2.0.0",
    "ember-data": "~3.1.0",
    "ember-export-application-global": "^2.0.0",
    "ember-load-initializers": "^1.0.0",
    "ember-maybe-import-regenerator": "^0.1.6",
    "ember-resolver": "^4.0.0",
    "ember-source": "~3.1.0",
    "ember-welcome-page": "^3.0.0",
    "eslint-plugin-ember": "^5.0.0",
    "loader.js": "^4.2.3",
    "typescript": "^2.9.1"
  },
  "engines": {
    "node": "^4.5 || 6.* || >= 7.*"
  }
}

image

mfeckie commented 6 years ago

@mschorsch It looks like and issue with Typescript 2.9.x

Pinning to 2.8.4 will allow you to keep working while the problem gets figured out 😄

chriskrycho commented 6 years ago

It's not TS 2.9, I'm pretty sure; it's actually a problem with the type defs. Try pinning to @types/ember@2.8.24; for some reason 2.8.25 dropped the required dependencies for jQuery and Handlebars' types when auto-generated by DefinitelyTyped.

dfreeman commented 6 years ago

I think this is actually a combination of an issue with TS 2.9 and the missing dependencies in @types/ember. There's a fix for the former on master—I mistakenly thought it was part of the 1.3.1 release already, but I'll cut 1.3.2 with that fix today.

As far as the missing dependencies go, pinning to @types/ember@2.8.24 as Chris said or manually adding @types/handlebars to your dependencies should solve it, but I'm not sure what our long-term solution looks like. I have to assume it was a bug in the types publisher, but I'm not sure the best way to get in touch with any of those folks, or whether the next publish will magically fix it.

mschorsch commented 6 years ago

Ok thanks. I've tested some scenarios. Here are the results:

  1. Adding handlebars (npm install --save-dev @types/handlebars)

    • => ember build hangs infinitely without message.
  2. Pinning typescript@2.8.4

    • => ember build but with the message node_modules/@types/ember/index.d.ts(14,23): error TS2688: Cannot find type definition file for 'handlebars'.
  3. Pinning typescript to 2.8.4 and adding handlebars (npm install --save-dev @types/handlebars)

    • => ember build without errors.
  4. Pinning @types/ember@2.8.24

    • => ember build hangs infinitely without message.
  5. Pinning @types/ember@2.8.24 and adding handlebars (npm install --save-dev @types/handlebars)

    • => ember build hangs infinitely without message.
phammers commented 6 years ago

I'm also experiencing the same issue - can confirm same as @mschorsch that pinning typescript 2.8.4 stops the issue.

dfreeman commented 6 years ago

@mschorsch @phammers We just released ember-cli-typescript 1.3.2, which should fix compatibility with TS 2.9 (i.e. without @types/handlebars installed you'll only see that error message once, rather than getting caught in an infinite loop 🙂)

phammers commented 6 years ago

Thanks @dfreeman for the quick response. Just upgraded and it works fine.

mschorsch commented 6 years ago

After upgrade to 1.3.2 ember-cli-typescript seems working now. Thanks @dfreeman.