types/_guidelines

noEmit does not apply

unional opened this issue ยท 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. ๐ŸŒท

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.

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. ๐Ÿ˜›

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).

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 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).

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

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.