prettier-vscode
prettier-vscode copied to clipboard
There is a problem with the export type for typescript
Summary
Format error when exporting using export type of typescript
Github Repository to Reproduce Issue
no
Steps To Reproduce:
- This is step 1.
- This is step 2. All steps should start with '1.'
Expected result
Describe what should have happened.
Actual result
Describe what actually happened instead.
Additional information
Feel free to attach a screenshot.
VS Code Version:
Prettier Extension Version:
OS and version:
Prettier Log Output
["INFO" - 下午5:02:33] Formatting d:\项目开发\3d-babylon\src\3D\mcProject\webGis\sanxiaBBL\MarkManagerShareMaterialOptimize.ts ["INFO" - 下午5:02:33] Using config file at 'd:\项目开发\3d-babylon\prettier.config.js' ["INFO" - 下午5:02:33] Using ignore file (if present) at d:\项目开发\3d-babylon.prettierignore ["INFO" - 下午5:02:33] File Info: { "ignored": false, "inferredParser": "typescript" } ["INFO" - 下午5:02:33] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used ["INFO" - 下午5:02:33] Prettier Options: { "filepath": "d:\项目开发\3d-babylon\src\3D\mcProject\webGis\sanxiaBBL\MarkManagerShareMaterialOptimize.ts", "parser": "typescript", "printWidth": 180, "tabWidth": 2, "useTabs": true, "singleQuote": true, "trailingComma": "all", "bracketSpacing": true } ["ERROR" - 下午5:02:33] Error formatting document. ["ERROR" - 下午5:02:33] Declaration or statement expected. (9:1) 7 | import BuoyPanel from './BuoyPanel'; 8 | // export type { ISpriteMark } from './libs/SpriteClassify';
9 | export type { ISpriteMark } from './libs/SpriteClassifyShareMaterialOptimize'; | ^ 10 | 11 | type Vec3 = Pick<Vector3, 'x' | 'y' | 'z'>; 12 | SyntaxError: Declaration or statement expected. (9:1) 7 | import BuoyPanel from './BuoyPanel'; 8 | // export type { ISpriteMark } from './libs/SpriteClassify'; 9 | export type { ISpriteMark } from './libs/SpriteClassifyShareMaterialOptimize'; | ^ 10 | 11 | type Vec3 = Pick<Vector3, 'x' | 'y' | 'z'>; 12 | at t (d:\项目开发\3d-babylon\node_modules\prettier\parser-typescript.js:1:347) at Object.parse (d:\项目开发\3d-babylon\node_modules\prettier\parser-typescript.js:14:180461) at Object.parse (d:\项目开发\3d-babylon\node_modules\prettier\index.js:9739:19) at coreFormat (d:\项目开发\3d-babylon\node_modules\prettier\index.js:13252:23) at format (d:\项目开发\3d-babylon\node_modules\prettier\index.js:13510:73) at formatWithCursor (d:\项目开发\3d-babylon\node_modules\prettier\index.js:13526:12) at d:\项目开发\3d-babylon\node_modules\prettier\index.js:44207:15 at Object.Success [as format] (d:\项目开发\3d-babylon\node_modules\prettier\index.js:44226:12) at t.default.
(c:\Users\刘俊杰.vscode\extensions\esbenp.prettier-vscode-7.1.1\src\PrettierEditService.ts:485:45) at Generator.next ( ) at s (c:\Users\刘俊杰.vscode\extensions\esbenp.prettier-vscode-7.1.1\dist\extension.js:1:9119) ["INFO" - 下午5:02:33] Formatting completed in 38.2684ms.
Your version of prettier is outdated, you need to use a version of prettier that supports the version of typescript you are using.