dev_compiler icon indicating copy to clipboard operation
dev_compiler copied to clipboard

TypeScript output

Open jmesserly opened this issue 10 years ago • 5 comments

This has been on our radar for a while, but I don't see an issue to discuss it, so here it is.

The goal would be to have a TypeScript output mode, in addition to the current ES6 (and work-in-progress Closure Compiler).

CC @ochafik who is working on the Closure Compiler backend.

jmesserly avatar Nov 23 '15 18:11 jmesserly

Would a full TypeScript output even be needed? Maybe ES5/Closure output plus the TypeScript definition files for it would be enough.

b-strauss avatar Dec 04 '15 08:12 b-strauss

good point. .d.ts files definitely would cover some of the use cases.

jmesserly avatar Dec 04 '15 16:12 jmesserly

Definition files and JS would be better than actual TS files as TS misses a good module system for importing out of project TS files but do have infrastructure for using JS modules with definition files.

Pajn avatar Jan 14 '16 13:01 Pajn

@Pajn I don't think this would be an issue. TypeScript now has ES6 modules. The old module system is deprecated, so TypeScript modules are basically ES6 modules with types. I successfully imported some pure third-party modules in my app.

I think the problem with TypeScript in general is the different type system. I have no idea how someone would, for example, represent named constructors in TypeScript.

b-strauss avatar Jan 14 '16 14:01 b-strauss

Importing the files is possible yes, but you will have to provide all dependencies (or type definitions) for the modules you are importing as all files that is necessary for compilation needs to be listed in the files array.

Pajn avatar Jan 14 '16 14:01 Pajn