Skip to content

Package typings file cannot contain tripleslash references #9

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
jbeckton opened this issue Apr 13, 2016 · 10 comments
Closed

Package typings file cannot contain tripleslash references #9

jbeckton opened this issue Apr 13, 2016 · 10 comments

Comments

@jbeckton
Copy link

So I got my custom library wired up but I have an issue with the Reference Path.. When i compile the Typescript in the app that imports the library I get...

error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.

if I delete the /// from the main Typescript file (import entry point) the error goes away but I cannot compile the Typescript in my library anymore.

How can I resolve this and keep both sides happy?

@jbeckton
Copy link
Author

I added /// to my main.ts and now I get a bunch of error TS2300: Duplicate identifier .

This may not be your issue but there must be a way to get the library and the app which uses it to play together.

@jbeckton
Copy link
Author

Seems like if Typescript in the library was not in the equation then everything would play. I have my library project "Linked" to my app project (NPM Link) while I am building it. Maybe is I just packaged the Library and installed the dist package with no Typescript things would play. That's alot of steps to take each time I update the package and then want to test it in my app.

@jvandemo
Copy link
Owner

@jbeckton — I have just released v0.5.0 with a possible fix that references browser.d.ts in tsconfig.json instead of using the tripleslash.

Can you please verify if that fixes your problem?

Thanks in advance!

@pauljeter
Copy link

This fixes the issue, thanks. After updating to 0.4.0 yesterday, I was going to create an issue and a pull request today, but you already addressed the issue.

@jvandemo
Copy link
Owner

@pauljeter — Thank you for taking the time to report your findings. Much appreciated!

I will close this issue for now. If anyone feels it needs to be re-opened, feel free to do so. Thanks!

@jbeckton
Copy link
Author

@jvandemo That did the trick! I used your tsconfig and that solved my issues. I was hoping for a simple solution because I have a lot of time into this already. Thanks for your help.

@jbeckton
Copy link
Author

@jvandemo Ok I spoke too soon, the problem I have now is that only the main ts file is getting compiled. I thought the ts compiler could traverse the other ts files via the import statments and compile them too but that's not the case for me. I do not want to have to add all of my ts files to the tsconfig files array.

@jvandemo
Copy link
Owner

@jbeckton — You will have to specify all your individual TypeScript files in the files array indeed. See an example tsconfig.json right here.

There is a feature request in the TypeScript repo where it is said that TypeScript 2.0 should support globs (e.g. *.ts). Hopefully that is indeed the case and we will be able to solve it more efficiently in the future.

If you are using Atom editor then using filesGlob instead of (or in addition to) files in tsconfig.json is an option as well. From what I understand Atom will then expand the globs from filesGlob for you and add all files to files automatically.

@jbeckton
Copy link
Author

Interesting about Atom, I am using VS Code though. I guess I'll have to wait for TS 2. In the mean time I can make it work from my original set up and Gulp hack to add and remove the /// reference path before and after compilation respectively. I guess my set up is an edge case and not very friendly to TS, but I need to develop a library and the app that uses it at the same time so I guess a hack is in order for now.

@jvandemo
Copy link
Owner

@jbeckton — Totally understandable. Feel free to keep us posted in case you find a user-friendly solution that works for you. I'm sure others (including myself) would be interested in hearing your findings. Thanks!

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

3 participants