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

tsconfig inheritance requires saving child tsconfig before changes in parent are applied to applicable files. #30742

Closed
ozyman42 opened this issue Feb 9, 2019 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@ozyman42
Copy link

ozyman42 commented Feb 9, 2019

  • VSCode Version: 1.30.2
  • OS Version: Windows 10

Steps to Reproduce:

  1. Create a new folder then open it in VSCode
  2. Create the project:
example_folder/
├── src
│   ├── example.ts
│   └── tsconfig.json
└── tsconfig-base.json

example_folder/tsconfig-base.json

{
    "compilerOptions": {
        "lib": [],
        "types": []
    }
}

example_folder/src/tsconfig.json

{
    "extends": "../tsconfig-base",
    "compilerOptions": {
        "noImplicitAny": true
    }
}

example_folder/src/example.ts

new Promise(()=>{});
console.log("hello world");
  1. Open example_folder/src/example.ts

You should see vscode complain about 2 errors in the file: the names Promise and console cannot be found. This is expected.

  1. Change example_folder/tsconfig-base.json from its original form to this:
{
    "compilerOptions": {
        "lib": ["esnext"],
        "types": []
    }
}

Expected behavior: the error about the Promise not being found should go away.
Actual behavior: the error is still there.

  1. Go to example_folder/src/tsconfig.json and hit the save key.

Only after this does the error go away. The save of the inherited tsconfig should trigger the errors to disappear, but it seems that these changes only get reflected in the inheriting tsconfig when it is saved again (even if the inheriting tsconfig file does not change).

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

@vscodebot vscodebot bot assigned mjbvz Feb 9, 2019
@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 3, 2019
@mjbvz mjbvz removed their assignment Apr 3, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Apr 3, 2019

Moving upstream as I can repo this with tsc --watch as well. Steps:

tsconfig.json

{
    "extends": "./tsconfig.base.json"
}

tsconfig.base.json

{
  "compilerOptions": {
  }
}

x.ts

const a: string = undefined;
  1. Run tsc --watch -p tsconfig.json
  2. See no errors
  3. Now open tsconfig.base.json and add "strict": true
  4. Save tsconfig.base.json

Bug
Nothing happens. Only after the tsconfig.json is saved do you see the error about strict null checks

@sheetalkamat
Copy link
Member

This is duplicate and same root cause as known issue: #17753

@sheetalkamat sheetalkamat added the Duplicate An existing issue was already created label Apr 4, 2019
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants