-
Notifications
You must be signed in to change notification settings - Fork 181
Declaration file emit #105
Comments
I'm not sure that TypeScript supports generation of "all-in-one" definition file for your library. Most likely we can emit a definition per source file, but I think that it's not what you want, right? I need to think about that. |
@s-panferov It would be best if it could be one definition. That way you could just set the |
@andrew-w-ross sorry for a long delay. I've had some time today to make basic implementation of Please try the version |
@s-panferov Thanks I'll give this a try. Although currently I do have a very hacky workaround. |
How can I use this.. I have "declaration": true in my tsconfig "CompilerOptions", do I have to set any other options to get the declaration file. |
I see that the d.ts files are generated but one for each file.. how can I get a single declaration file for all the code. |
@akasapu2985 Looks like the files have to be separate or the declaration becomes ambient. So you would have to reference your "entry point" declaration file in your typings field in the package.json. @s-panferov After going through some testing your current solution seems like the best. As I mentioned to @akasapu2985 to roll this up into a single declaration file makes the declaration ambient and therefore not suitable to include in as the typings for the package created. Doing the work that would be required to roll up the declarations is a non-trivial task. |
@andrew-w-ross you're right, declaration "squashing" is not a trivial thing and I think it can only be implemented on TS side. I don't have any libraries that require declaration generation, so I'm waiting for some real-world feedback about the feature. |
For a very simple single directive bower/npm module, creating a single bundle, I've used the directions here: Except that I was not able to point to just a single main .d.ts file but rather use the "experimental" feature of globbing. I'm not even sure it's a real glob implementation because the documentation states that it looks for "/**/*.d.ts" in the configuration. It would definitely be nicer if something like this could be done on a bundle by bundle basis. This PlugIn isn't really using properties of the compiler to determine what should be processed. It's more like a trigger to run a command.
|
Not sure if I have the entirely same issue. I use |
I am having the same issue, I need this feature! I am using I am using Because the For example, the import { IMediaData } from "file/media"; but when using my module, it shows:
I can "fix" this by setting Related issue here: microsoft/TypeScript#21507 (comment) Webpack config: |
Hi
How do I get declaration file to emit? I've set
"declaration": true
in my tsconfig.json and I've set the library in the output on my webpack config.Is there anything else I'm not doing?
The text was updated successfully, but these errors were encountered: