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

declarationDir outputs extra src folder? -- need to set rootDir in tsconfig #64

Closed
szimek opened this issue Mar 11, 2018 · 4 comments
Closed
Assignees
Labels
kind: support Asking for support with something or a specific use case solution: tsc behavior This is tsc's behavior as well, so this is not a bug with this plugin

Comments

@szimek
Copy link

szimek commented Mar 11, 2018

What happens and why it is wrong

I'm rewriting my library (https://github.com/szimek/signature_pad) to TypeScript - this is the first time I'm working with this language. I've specified declarationDir: 'dist/types' in tsconfig.js and set useTsconfigDeclarationDir: true. However, after building the library, the declaration files end up in dist/types/src. Is it supposed to be like this? If not, how can I change it, so that they end up directly in dist/types?

Versions

  • typescript: 2.7.2
  • rollup: 0.56.5
  • rollup-plugin-typescript2: 0.12.0

rollup.config.js

https://github.com/szimek/signature_pad/blob/typescript/rollup.config.js

tsconfig.json

https://github.com/szimek/signature_pad/blob/typescript/tsconfig.json

package.json

https://github.com/szimek/signature_pad/blob/typescript/package.json

@ezolenko ezolenko self-assigned this Mar 12, 2018
@ezolenko
Copy link
Owner

Yeah, typescript mirrors your project structure considering project root to be location of tsconfig.json -- plugin uses unmodified d.ts path to write out declarations when useTsconfigDeclarationDir is used.

If you don't use useTsconfigDeclarationDir, declarations will be dumped together with rollup output.

Either way should work if you set correct types property in package.json, but neither is very clean in your case I guess...

@szimek
Copy link
Author

szimek commented Mar 12, 2018

@ezolenko Thanks!

If you don't use useTsconfigDeclarationDir, declarations will be dumped together with rollup output.

That's good enough ;) Or I'll just rename dist/src to dist/types after building everything...

@szimek szimek closed this as completed Mar 12, 2018
@agilgur5 agilgur5 changed the title Question: How to specify declaration dir to output files directly in build folder? How to specify declarationDir to output directly in build folder without extra src folder? -- need to set rootDir May 22, 2022
@agilgur5 agilgur5 added solution: tsc behavior This is tsc's behavior as well, so this is not a bug with this plugin kind: support Asking for support with something or a specific use case labels May 22, 2022
@agilgur5
Copy link
Collaborator

typescript mirrors your project structure

You can set rootDir in your tsconfig.json to influence this behavior.
See #275 (comment) for more details.

That issue effectively duplicates this one, but has gotten a lot more activity

@agilgur5 agilgur5 changed the title How to specify declarationDir to output directly in build folder without extra src folder? -- need to set rootDir How to specify declarationDir to output directly in build folder without extra src folder? -- need to set rootDir in tsconfig May 22, 2022
@agilgur5 agilgur5 changed the title How to specify declarationDir to output directly in build folder without extra src folder? -- need to set rootDir in tsconfig declarationDir to outputs extra src folder? -- need to set rootDir in tsconfig May 22, 2022
@agilgur5 agilgur5 changed the title declarationDir to outputs extra src folder? -- need to set rootDir in tsconfig declarationDir outputs extra src folder? -- need to set rootDir in tsconfig May 22, 2022
@wakaztahir

This comment was marked as spam.

Repository owner locked as resolved and limited conversation to collaborators Sep 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: support Asking for support with something or a specific use case solution: tsc behavior This is tsc's behavior as well, so this is not a bug with this plugin
Projects
None yet
Development

No branches or pull requests

4 participants