Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add extendsExact: bool property to tsconfig.json #30163

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
5 tasks done
nodkz opened this issue Mar 1, 2019 · 5 comments
Closed
5 tasks done

Add extendsExact: bool property to tsconfig.json #30163

nodkz opened this issue Mar 1, 2019 · 5 comments
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

@nodkz
Copy link

nodkz commented Mar 1, 2019

Search Terms

Lerna monorepo, extends, config inheritance, disable relative path.

Suggestion

According to design choise of extends property to make paths relative - it brings some problems for monorepos with multiple packages with different configs.

I suggest to add extendsExact: bool property to tsconfig.json which will keep paths as is (without resolving relative paths)

It quite simple to implement with current codebase and allows to developers use different scenarios.

Use Cases

We cannot use base template for all packages (we have 20 packages and need to fix in every config includes and excludes sections). It quite hard to track. If we add something to base template, we should to change all tsconfigs in every package.

My real use case is quite complex. We have boilerplate repo, where defined all configs, dev packages and code conventions. I maintain this MAIN repo. All other developers fork my repo and adds their code to packages folder (in Lerna way) where use some of config from root folder for their packages. So at any time I may update my boilerplate (MAIN repo) and all other teams may easily merge my changes without affecting their code in packages folder.

Examples

We have a base configs:

// tsconfig.server.json
{
  excludes: ["node_modules"],
  includes: ["src/**/*.ts", "server.globals.ts"]
}
// tsconfig.client.json
{
  excludes: ["node_modules", "__tests__"],
  includes: ["src/**/*.ts"]
}

And in Lerna monorepo developers may use these tsconfig as real dumb template:

tsconfig.server.json
tsconfig.client.json
lerna.json
packages/
 - pkg1-server
     - tsconfig.json { extends: '../../tsconfig.server.json', extendsExact: true } 
 - pkg1-client
     - tsconfig.json { extends: '../../tsconfig.client.json', extendsExact: true }      
 - pkg1-client-admin
     - tsconfig.json { extends: '../../tsconfig.client.json', extendsExact: true } 
 - pkg2-node-driver
     - tsconfig.json { extends: '../../tsconfig.server.json', extendsExact: true } 
 - ... tons of other packages ...

So with such monorepo I can just change root config file, and all packages gets new config with EXACT paths for (files, includes, excludes) like they are in root config files.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Mar 7, 2019
@NoelAbrahams
Copy link

I think this will also fix #29172.

@SgtPooki
Copy link

SgtPooki commented Aug 8, 2019

I would love to see this implemented. @nodkz have you looked into creating a PR for this? We might be able to get this in more easily if we have code ready for them to import.

@zheeeng
Copy link

zheeeng commented Oct 30, 2019

It is useful to the monorepo project which its sub packages all have a same tsconfig.json configuration but need they own outDir and typeRoot

@rhyek
Copy link

rhyek commented Oct 31, 2019

I have a related use-case where I am also using lerna and every package is basically running some sort of filewatcher that executes a tsc compilation on its respective source code. I'm running all of them from my monorepo root with lerna run --parallel dev and whenever I have an error in any of the packages the paths I see in the terminal are relative and therefore these are not showing up in VSC under the Problems tab and I can't cmd+click the file path in the terminal to navigate to it either.

@davwheat
Copy link

I'd really love this.

We want to standardise configs across all our repos at Flarum, but this means duplicated entries at the moment.

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

8 participants