_guidelines icon indicating copy to clipboard operation
_guidelines copied to clipboard

noEmit does not apply

Open unional opened this issue 8 years ago • 7 comments

We use typings to bundle the typings and using tsc to run test, so noEmit actually does not work.

What should we do for @types when redirect has landed?

Do we need to put typings into a single file or need to use /// <reference?

In either case, since we are writing d.ts, noEmit still doesn't apply. 🌷

unional avatar Feb 13 '17 03:02 unional

We use typings to bundle the typings and using tsc to run test, so noEmit actually does not work.

In some places, you may use tsc to run the .ts tests (I do in a couple of places where I'm cheating and not using ts-node, just for checking compilation). Also avoids certain editors going compile-on-save crazy.

What should we do for @types when redirect has landed?

Still not sure, I was really, really hoping TypeScript would just adopt using package.json consistently here so we have to wait and find out.

Do we need to put typings into a single file or need to use /// <reference?

Should be the same as always, hopefully they'll pull the main out of package.json.

In either case, since we are writing d.ts, noEmit still doesn't apply.

Yeah, I realise. It's not there for the .d.ts files though, but for the .ts files people might use to write tests and whatnot.

blakeembrey avatar Feb 13 '17 04:02 blakeembrey

For writing test, if noEmit, the test can't run, just compile though.

EDIT: Meaning, I have to have two versions of tsconfig.json. One for compile only, one for running tests.

Also avoids certain editors going compile-on-save crazy

Just turn it off in the tsconfig.json or in the IDE. 😛

unional avatar Feb 13 '17 04:02 unional

For writing test, if noEmit, the test can't run, just compile though.

Yes, that's intentional. The guidelines are designed to use tsc directly (compile-time check) and then ts-node (runtime check) - there's no time you'd want to generate .js files from the .ts files, but you shouldn't need two tsconfig.json files (I only use one for everything).

blakeembrey avatar Feb 13 '17 05:02 blakeembrey

I see, as you do (and the current generator-typings scaffold to) the ts-node route. Recently my workflow does not use ts-node, so I do compile and run. 😄

unional avatar Feb 13 '17 05:02 unional

@unional That makes sense. We could change it to do outDir and execute JavaScript tests instead, that's probably a better approach overall to move to eventually, but it's pretty similar (just no files generated instead).

blakeembrey avatar Feb 13 '17 05:02 blakeembrey

I can keep this open until we update it (if we decide to?).

blakeembrey avatar Feb 13 '17 05:02 blakeembrey

generator-typings@2 was always in my list. And I want to update it for @types. 😄

I'm not using ts-node for my own projects because I'm using ava, which run tests in parallel. I couldn't find a way to make ts-node and ava work well together.

unional avatar Feb 13 '17 05:02 unional