TasukuUno / typed-classnames-loader

Webpack loader for classnames auto bind and d.ts auto generation
https://www.npmjs.com/package/typed-classnames-loader
10 stars 1 forks source link

Definitions output directory #1

Open artyomsv opened 6 years ago

artyomsv commented 6 years ago

Hi,

Is it possible to define the output directory for generated definitions?

Thanks in advance!

Artyom

TasukuUno commented 6 years ago

Hi @artyomsv, thank you for your issue!

Unfortunately, I think we can not do it now because of spec of type definitions... for example, we have a file tree like this:

src
├── components
│   ├── Button
│   │   ├── index.ts
│   │   └── style.css
│   └── Page
│       ├── index.ts
│       └── style.css
├── tsconfig.json
└── types
    └── styles
        └── index.d.ts

and, when we want to put definitions of css for Button and one for Page into ./types/style/index.d.ts, we will plan to output a file like this.

declare module "../../components/Button/style.css" {
  // style definitions
}

declare module "../../components/Page/style.css" {
  // style definitions
}

However, TypeScript does not allow it. We will got an error like this:

Ambient module declaration cannot specify relative module name.

So, at the moment, I think that it is not worth making such a function.