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

Experimental support for decorators is a feature that is subject to change ... #102874

Closed
mehmetgunacti opened this issue Jul 18, 2020 · 4 comments
Assignees

Comments

@mehmetgunacti
Copy link

mehmetgunacti commented Jul 18, 2020

  • VSCode / OS Version:
Version: 1.47.1
Commit: 485c41f9460bdb830c4da12c102daff275415b53
Date: 2020-07-14T00:13:57.513Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.4.0-40-generic

Steps to Reproduce:

  1. create a new .ts file and paste this code in it:
import { Injectable } from '@angular/core';

@Injectable({
    providedIn: 'root'
})
export class SyncService {
}

A warning message appears:

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.

The warning message shouldn't appear because of:

@Injectable({
    providedIn: 'root'
})

Meaning this class (SyncService) doesn't have to be referenced anywhere else in the project to run as a service. Please note, there are other (earlier created) services in the project which doesn't get this warning.

here

Does this issue occur when all extensions are disabled?: Yes

@IllusionMH
Copy link
Contributor

@msegmx can you show what is in your "files", "include", "exclude" of your configuration and if this file matches anything before imported to other file.

TL;DR; If file is not part of "include" and wasn't imported to any file that is in imports tree form files in "files" and "include" - it will be part of "Inferred project" that has default configuration (without decorators enabled).
You need to make sure that files you are going to works will be matched by your "include" configuration to make sure that they are part of proper project.

A bit more details in similar answer

@mehmetgunacti
Copy link
Author

I created the project recently with "ng new" (Angular 10).
Here are the relevant tsconfig files (the only change is "baseUrl" : "./" -> "./src"):

tsconfig.json:

{
  "files": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.spec.json"
    },
    {
      "path": "./e2e/tsconfig.json"
    }
]
}

tsconfig.app.json:

{
  "extends": "./tsconfig.base.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

tsconfig.base.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./src",
    "outDir": "./dist/out-tsc",
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2015",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ]
  },
  "angularCompilerOptions": {
    "strictInjectionParameters": true,
    "strictTemplates": true
  }
}

@IllusionMH
Copy link
Contributor

Yep, most likely that's the same problem described in that comment, but different observed result (I think you should have problem with auto-import of this file too).

This issue has nothing to do with VS Code and most likely is not TS issue (because it's works as expected now - only files from files and include are part of the project as documented). There are couple of opened tracking issues in Angular repo.

At this point proper solution mentioned in doc linked in microsoft/TypeScript#39632 in section 1. Unreferenced files don’t inherit compiler options

@mehmetgunacti
Copy link
Author

Indeed I have had problems with auto-completion.

Thank you so much for shedding light on this issue. Turns out every Angular developer using v10 should be aware of these changes that come with the "solutions style tsconfig" approach.

I prefer not to change the tsconfig files, but rather will continue to temporarily import the new file (service) until I actually import and use it in a component, etc. But at least I know now why this warning happens.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants