Angular-cli: Generated tsconfig.json file should not list files.

Created on 9 May 2016  路  7Comments  路  Source: angular/angular-cli

  1. Windows 10
  2. Versions. Please run ng --version.
angular-cli: 1.0.0-beta.1
node: 4.2.6
os: win32 x64

Steps

  • create a new project using ng new project
  • switch to the directory and open VSCode 1.0.0 on it
  • open project.component.spec.ts and then project.component.ts

Observe that you get errors about unsupported decorators in the second file. The reason is that the generated tsconfig.json file has a files sections only including main.ts and typings.d.ts. Either the files section must list all src files or better be removed to cover all *.ts files automatically. Otherwise the files under src will not honor the tsconfig.json settings.

medium (days) 1 (urgent) bufix

Most helpful comment

Fixed by #1455.

All 7 comments

Generated output causes issues in IntelliJ IDEA as well:

  • With the generated files section it warns that it won't compile .ts files, as they are not listed in tsconfig.json
  • Without the files section IDEA is happy, but basic tasks like ng server or ng test fail with cryptic stacktraces containing a _"Cannot find name 'module'."_ as hint.
_Update:_

A workaround is to choose "set options manually" and transform the configuration of tsconfig.json into tsc arguments.

For me the following arguments seem to do the trick:
--experimentalDecorators --emitDecoratorMetadata --mapRoot "/" -m "commonjs" --moduleResolution "node" --noEmitOnError --outDir "../dist/" --rootDir "$ModuleFileDir$/src" --sourceMap -t "es5" --inlineSources

I have created ts configuration files that work in VS Code and Broccoli. I posted them here: https://github.com/Microsoft/vscode/issues/8954#issuecomment-231960894.

It appears the two sets of settings are mutually exclusive. If I apply the VS Code Settings, Broccoli breaks. If I apply the Broccoli Settings, VS Code throws errors.

I can post more of my project if that will help. I can also give an individual access to our BitBucket repo.

I see a solution here for IntelliJ IDEA.

I'm not sure how I'm supposed to configure VS Code so the Editor and Broccoli are both happy.

Maybe I'm too thick to see the solution?

I tried looking at Broccoli for help. I have no idea where to start. They have hundreds of projects. Sorry to be such a newb.

Based on my conversations with Microsoft, the files attribute is a violation of the current standard for TS. This is the same issue that IDEA is having. It will also not work out of the box.

How would I raise this as an issue with Broccoli?

Does Broccoli have a newer compiler to which we can upgrade which is standards compliant?

Exactly which TS compiler is being used?

I have looked at broccoli-typescript.js and it looks like you are using that setting to filter the *.d.ts files that are used by the incremental compile. I commented out lines 59-61. That made me clean up the typings directory. However, I still have two problems:

  1. I am using the jQuery typings definitions which appear to conflict with protractor's definition of '$' which is a little weird.
  2. I am getting an error on the definition of modules asking me to use NodeModule. I am guessing this one of the reasons you wanted to filter the *.d.ts files?

Fixed by #1455.

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._

Was this page helpful?
0 / 5 - 0 ratings