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

How can I share a custom argument from a user's tsconfig.json to my custom plugin? #26

Open
aloisdg opened this issue Feb 24, 2022 · 1 comment

Comments

@aloisdg
Copy link

aloisdg commented Feb 24, 2022

How can I share a custom argument from a user's tsconfig.json to my custom plugin?

To install a plugin we do:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-my-plugin"
      }
    ]
  }
}

I would love to be able to write something akin to:

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-my-plugin",
        "foo": "bar",
        "options": ["verbose", "production"]
      }
    ]
  }
}

or even

{
  "compilerOptions": {
    "plugins": [
      {
        "name": "typescript-my-plugin"
      }
    ],
    "foo": "bar",
    "options": ["verbose", "production"]
  }
}

I checked the Intro to the TSConfig Reference without finding what I was looking for.

I also posted this question on Stack Overflow: https://stackoverflow.com/questions/71255330/how-can-i-share-a-custom-argument-from-a-users-tsconfig-json-to-my-custom-plu

@joelso
Copy link

joelso commented Feb 26, 2022

AFAIK there is no official support in tsconfig.json for that, so you have to use for example ttypescript which provides more options like you want:

https://github.com/madou/typescript-transformer-handbook#consuming-transformers
https://github.com/cevek/ttypescript#compileroptions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants