Skip to content

"Move to new file" edits files in tsconfig.json #38714

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

Closed
OliverJAsh opened this issue May 21, 2020 · 1 comment
Closed

"Move to new file" edits files in tsconfig.json #38714

OliverJAsh opened this issue May 21, 2020 · 1 comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@OliverJAsh
Copy link
Contributor

OliverJAsh commented May 21, 2020

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:

Code

tsconfig.json:

{
    "files": ["src/main.ts"]
}

src/main.ts:

import { foo } from './foo';

const bar = 1;

console.log(foo, bar);

src/foo.ts:

export const foo = 1;
  1. In src/main.ts, select the line const bar = 1;
  2. Run the "move to new file" command

Expected behavior:

  1. The code is moved to a new file and imported in src/main.ts
  2. tsconfig.json should not be edited

Actual behavior:

  1. The code is moved to a new file and imported in src/main.ts:
    import { foo } from './foo';
    import { bar } from './bar';
    
    console.log(foo, bar);
  2. The new file is added to files in tsconfig.json:
    {
        "files": ["src/main.ts", "./src/bar.ts"]
    }

Playground Link:

Related Issues: #24857 (comment)

@RyanCavanaugh
Copy link
Member

This is considered desirable behavior because if you have composite on, listing all the files is mandatory if you're using a files array

@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants