Closed RhodeHummel closed 2 months ago
Would you be able to add the content you were trying to transform, the transformation script you wrote, the command you ran to transform it, and the expected output, to the issue?
I think this will need upstream changes (recast and/or ast-types)
@ElonVolo Here is a simple case. Basically, I just want it to run without any errors. Hope this is enough information for you.
// test-file.ts
export class Test {
public accessor myValue = 10;
}
// test-transform.ts
import { FileInfo, API, Options } from 'jscodeshift';
module.exports = function (file: FileInfo, { j }: API, _options: Options) {
const root = j(file.source);
// Do nothing just output the file again
return root.toSource();
};
BTW: I noticed that this is already supported by babel but the plugin for it does need to be configured. Could that be the problem in this case?
I'm running the transform and file code you submitted and I'm not getting any errors. Nothing's being transformed, which is expected as no modifications have been made.
Are you getting some different result on your end?
I think this will need upstream changes (recast and/or ast-types)
I looked at the recast code and there does seem to be some support for Typescript's accessor keyword.
@ElonVolo I definitely get an error. There is no error message, it just prints out results 1 error instead of 1 unmodified. I have created an isolated test case and included it here.
To see the error, run npx ts-node test.ts
It looks like jscodeshift does not currently support the accessor keyword that was added typescript in 3.9. Can we please add support for this. Thank you.
https://github.com/microsoft/TypeScript/pull/49705 https://github.com/tc39/proposal-decorators