brunch / typescript-brunch

Adds TypeScript support to Brunch

Home Page:http://brunch.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Definition files usage

opened this issue · comments

I tried to use a definition file with this plugin. I naively copied it next to my app.ts, but I only get this error:

error: Compiling of app/excalibur.d.ts failed. Debug Failure. False expression: Output generation failed

The excalibur.d.ts comes from https://github.com/excaliburjs/Excalibur/r eleases/tag/v0.7.0 but I get the same error with an empty test.d.ts

I think your problem is such as this issue.

@colinbate Do you have an idea about this problem ?

It might be related to that, but off the top of my head, you should probably not have your .d.ts files next to your application files. Those definition files are not meant to be built into your application, which is likely what Brunch is trying to do because it just sees them as TypeScript files. Typically you would put those files in a sibling directory to app, maybe called typings. Something that Brunch isn't watching.

That said, it should be possible to exclude the definition files within the plugin, so if you have a good reason for putting them together then I suppose that could be added.

You may also try running the regular tsc over your project to see if it has issues with the definition. If you run it with the --noEmit flag it won't output anything just check for errors. If that works, then it is probably related to the isolation mode issue @baptistedonaux mentioned. I think I might remove that error generation until after we sort out something with the language service.

@colinbate You're free to improve this part if you think that can be improved.

I think the root problem is the too-restrictive compiler host created in transpile.js. I discuss my workarounds here:

#35 (comment)

And in #45.