Closed STRd6 closed 2 years ago
That's because CoffeeSense's output files are plain JavaScript. I did this because the normal compiler also does not output TS and any such syntax should therefore be an error. That said, it is of course a valid desire to get TS output. To make this work, the only changes needed are changing the two occurences of javascript
to typescript
in files embeddedSupport.ts
and coffeescriptDocumentRegionParser.ts
. I also did this in the typescript branch which uses a special CS fork by edemaine with actual and explicit TypeScript support. Afaik it's unfinished business, and it adds completely new syntax to CoffeeScript.
Now I could simply switch CoffeeSense to TS output, but there is (only?) one significant drawback: JSDoc typings don't work in TypeScript. That means, with the two changes mentioned above, your as const
stuff above works, but e.g. func = (###* @type {string} param) =>
loses its meaning. I have no solution for this as of now, but maybe you have?
to be clear, the error you're seeing does not come from the integrated CS compiler (because your code snippet is valid CS, but from the integrated TS type checking based on the JS that CS compiler outputs.
The JSDoc typings are much more valuable to me currently. I guess we need to find that TypeScript/CoffeeScript successor eventually 🚀
I'm not sure if this is a CoffeeSense issue or not but when using backticks to put literal JS/TS I get the following error:
Type assertion expressions can only be used in TypeScript files