ember-cli-typescript: Type errors crash the build on Ember CLI 3.15+
Edit by @chriskrycho:* original title was “Does not appear to work with Ember 3.27”. Updated to reflect the actual underlying issue in Ember CLI.
Please paste the output of ember -v here
❯ ember -v
ember-cli: 3.27.0
node: 12.20.2
os: linux x64
Please paste the output of tsc -v here
❯ yarn tsc -v
Version 4.3.5
Please paste the version of ember-cli-typescript and ember-cli-typescript-blueprints here
4.2.1 blueprints package removed
Please paste your tsconfig.json and tslint.json or eslint.json (if applicable) below
default w/ 4.2.1
What are instructions we can follow to reproduce the issue?
Repro is these changes: https://github.com/NullVoxPopuli/ember-play/pull/5/commits/8dcf53e06fd9f40182dd29e0a99aeb8fe8e5a94b
git clone git@github.com:NullVoxPopuli/ember-play.git
git checkout 8dcf53e06fd9f40182dd29e0a99aeb8fe8e5a94b
yarn
ember s
# error! (ember-cli crashes)
Inverse reproduction (fix?): Remove ember-cli-typescript: https://github.com/NullVoxPopuli/ember-play/pull/5/commits/689c0ee0777c6e57e9714f319f8f04bb8c356c63
- Downside: no more type checking working in ember-cli terminal
Now about that bug. What did you expect to see?
This is a WIP PR / Library, but, I expect to still be able to run /tests while I iterate on implementation and not have to continually restart ec-ts whenever there is an error.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (9 by maintainers)
Commits related to this issue
- Reproduce issue: https://github.com/typed-ember/ember-cli-typescript/issues/1439 — committed to NullVoxPopuli/ec-typescript-repro-1439 by NullVoxPopuli 3 years ago
I went hunting and it looks like the situation is pretty much what I was speculating above. I spun up fresh app with an in-repo addon that returns
Promise.reject('uh oh')frompostBuild()after each even-numbered (re)build.Here’s the output for an initial build and three subsequent rebuilds (so in total, success -> fail -> success -> fail):
ember-cli@3.14.0, Node 12/16ember-cli@3.15.0-beta.1, Node 12ember-cli@3.15.0-beta.1, Node 16Prior to 3.15, the CLI treated promise rejections in
postBuildas failing the build, so in both older and newer versions of Node, everything works as expected.Starting in 3.15, a promise returned from
postBuilddoesn’t get.catch()ed, meaning the rejection goes unhandled. In older versions of Node, this emits a warning (and seemingly still does fail the build, which is interesting), but in more recent Node versions, that unhandled rejection warning terminates the process.Like I said above, given that ember-cli does wait for
postBuildpromises (i.e. it doesn’t just ignore thepostBuildreturn value), it seems like a bug there that the rejection goes unhandled, and I think the behavior prior to 3.15 was correct.For what it’s worth, our app & addons work with ember-source 3.27.5 & latest ember-cli-typescript. So I do not think it is a general issue, but probably some combination of another addon or so.
I think we got the confusion sorted out in Discord, but for anyone else reading along in this thread:
noEmitOnErroris a TypeScript configuration option (not something we invented!) that means “do not emit transpiled code when there’s a type error.”