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

tsify can't do what ts-loader can (or if it can I haven't managed to work out how) #90

Closed
johnnyreilly opened this issue Oct 25, 2015 · 1 comment

Comments

@johnnyreilly
Copy link
Member

First of all, apologies for the slightly trollish title - I couldn't come up with one that was descriptive without sounding a bit ... nasty. Anyway.

Technically this is a continuation of #73. However, since that's become something of a discussion thread I thought I'd raise a new issue so this didn't get lost in the noise.

Background first, I wanted to do this:

  • write TypeScript code in Atom using Atom-TypeScript (crucially without Atom actually performing the transpilation)
  • write React with JSX using TypeScript
  • write Jasmine tests in TypeScript
  • write unit tests featuring JSX using TypeScript
  • have my code type checked by TypeScript, emitted as ES6 and transpiled by Babel
  • have Karma run my unit tests continually (watching files)

At the time I started I was happily using Browserify and so tsify was the logical first port of call. As #73 testifies, I failed straight out the gate.

Finally I decided to see if I could get webpack working with ts-loader to do the same thing. I succeeded and globalize-so-what-cha-want is now built with Webpack.

I wanted to pass on what I've learned as I've tried to get tsify working on my project.

These are the problems I've had:

  • tsify doesn't pay attention to files property in tsconfig when it comes to typings / d.ts files. As a consequence you have to directly supply them to karma.
  • tsify doesn't seem to work well with Karma. I'm ending up with these errors when I have tsx files in the mix.
25 10 2015 09:52:39.849:ERROR [framework.browserify]: bundle error
25 10 2015 09:52:39.849:ERROR [framework.browserify]: TypeScript error: Error TS6054: File 'test/demo/components/Module.
tests.tsx' must have extension '.ts' or '.d.ts'.
  • tsify doesn't seem to respect tsconfig.json very well straight out of the box. @basarat has alluded to this here. In my browserify set up I'm having to force it to use the a specific tsconfig.json which kind of blasts you out of the water when you have several of these in play to enforce difference compilation contexts. This may be what's causing my Jasmine pain. Also, it's not obvious that you have to do this. It was only down to @basarat having a play with the project that I got it that far.

That's all for now - hopefully tsify can evolve to be more "seamless". I did actually manage to get tsify compiling typescript with babel which is great. But testing wasn't a go-er and I can't live without it. I'm sure these issues can be overcome and I'm happy to try and help if I can. Here are the reference repo's:

tsloader (all working): https://github.com/johnnyreilly/globalize-so-what-cha-want
tsify (main code working, unit testing not working): https://github.com/johnnyreilly/globalize-so-what-cha-want-typescript (so named because it was my first attempt to port to typescript)

Finally, thanks for all your hard work on tsify and the help you've provided to me as I've struggled to get things up and running.

@smrq
Copy link
Member

smrq commented Apr 20, 2016

Closing old issues; I think most(?) of these issues should be resolved with the recent updates to tsconfig handling.

@smrq smrq closed this as completed Apr 20, 2016
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

2 participants