Closed maricn closed 5 years ago
Hi @maricn,
Actually, the extension works well with TypeScript and there should not be any problems.
Can you create a new file with the following fragment so that we check that the primitive case works well? Don't forget to check that the language of the file is TypeScript or TypeScript React (shown in the bottom right corner).
function doFoo(foo: string) {
if (foo) {
return false;
}
return foo;
}
I also see some syntax errors in the log that you've attached. Please note that code actions only work when the file you are editing has no syntax errors. If there are none, please attach the code snippet of your code, maybe the extension`s parser fails where it shouldn't.
Cheers!
Hm.. I tried it javascript files and it works. On the basic example that you provided, it also works. So I guess, there is some other problem.
I think I narrowed it down to syntax errors in my service classes (I'm using NestJS with typescript). It's always reporting syntax errors on export class ClassName {
line where such class was decorated with @Injectable()
(coming from @nestjs/common
).
import { Injectable } from '@nestjs/common';
@Injectable()
export class EmailService {
}
After a bit of poking around, it might be related to the fact typescript decorators are an experimental feature. I have them enabled in my project's tsconfig
but your extension always reports those lines as having syntax errors. Interestingly, it happens for class and method decorators, but not for property decorators. 🤔
Thank you for looking into it @maricn!
I've just checked and decorators are indeed not supported by the version of Babel that this extension uses.
I'm now privately testing a new version of the extension with an updated @babel/parser
and some other new features. The latest version works with decorators well, so as soon as I finish testing and publish a new release the problem will go away.
Cheers!
Thank you for quick response. Much appreciated! 🖖
Closing the issue as v0.11.0 is now released.
OK, I'm editing my old question (below), since I realized I'm trying it with
typescript
and that's why it's not working.Do you have any plans to support
typescript
?