angular / angular

Deliver web apps with confidence 🚀
https://angular.dev
MIT License
96.19k stars 25.46k forks source link

alpha.51/52 regression: Typescript error - Type expected #5784

Closed IgorMinar closed 8 years ago

IgorMinar commented 8 years ago
[DiffingTSCompiler]: Typescript found the following errors:
  node_modules/angular2/src/core/metadata/di.d.ts (32, 12): Type expected.
Error: [DiffingTSCompiler]: Typescript found the following errors:
  node_modules/angular2/src/core/metadata/di.d.ts (32, 12): Type expected.
    at DiffingTSCompiler.doFullBuild (/Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:141:29)
    at DiffingTSCompiler.rebuild (/Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/lib/broccoli/broccoli-typescript.js:71:18)
    at DiffingPluginWrapper.rebuild (/Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/lib/broccoli/diffing-broccoli-plugin.js:86:45)
    at /Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/node_modules/ember-cli/node_modules/broccoli/lib/api_compat.js:42:21
    at lib$rsvp$$internal$$tryCatch (/Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:505:17)
    at /Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1001:13
    at lib$rsvp$asap$$flush (/Users/iminar/Dev/angular-cli-tests/sample-41/node_modules/angular-cli/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
    at doNTCallback0 (node.js:417:9)
    at process._tickCallback (node.js:346:13)

This seems to be a bug in typescript 1.7.3 introduced in alpha.51. The d.ts that we produce now and publish to npm fail the type-check when compiled against an angular app.

originally reported as https://github.com/angular/angular-cli/pull/98

// @mhegazy - known issue? This seems related to the other changes I had to make in angular/angular to get us onto 1.7.3: https://github.com/angular/angular/commit/51cb7586e0851734f497a7f6d0f6d68d818a963e#diff-e9823adbf8e551100ff36e0a9b9607ecL184

IgorMinar commented 8 years ago

@robwormald pointed out that the issue doesn't happen with typescript@1.7.3 but only with typescript@1.6.2.

So we don't need to rush to cut a new alpha because by updating typescript people can resolve this issue locally.

mhegazy commented 8 years ago

@IgorMinar, The issue is that "this" types were introduced in TS 1.7.3; they are not a supported syntax in 1.6.*. Looking at the code base, this seems to be the only location of "this" types in the angular code base. so your change in #5784 should be sufficient. There are some documentation about the breaking change, but we will try to think how we could mitigate issues like these in the future. sorry for the trouble.

IgorMinar commented 8 years ago

OK. Thanks! On Thu, Dec 10, 2015 at 10:05 AM Mohamed Hegazy notifications@github.com wrote:

@IgorMinar https://github.com/IgorMinar, The issue is that "this" types https://github.com/Microsoft/TypeScript/pull/4910 were introduced in TS 1.7.3; they are not a supported syntax in 1.6.*. Looking at the code base, this seems to be the only location of "this" types in the angular code base. so your change in #5784 https://github.com/angular/angular/issues/5784 should be sufficient. There are some documentation about the breaking change https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#changes-in-inferring-the-type-from-this, but we will try to think how we could mitigate issues like these in the future. sorry for the trouble.

— Reply to this email directly or view it on GitHub https://github.com/angular/angular/issues/5784#issuecomment-163704549.

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.