fix(code-generator): upgrade prettier parser from babel to babel-ts, fix some ts parse error (#2166)

This commit is contained in:
eternalsky 2023-06-09 17:26:02 +08:00 committed by GitHub
parent 343954009e
commit 3a21709e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ const factory: PostProcessorFactory<ProcessorConfig> = (config?: ProcessorConfig
const codePrettier: PostProcessor = (content: string, fileType: string) => {
let parser: prettier.BuiltInParserName | any;
if (fileType === 'js' || fileType === 'jsx' || fileType === 'ts' || fileType === 'tsx') {
parser = 'babel';
parser = 'babel-ts';
} else if (fileType === 'json') {
parser = 'json-stringify';
} else if (PARSERS.indexOf(fileType) >= 0) {