prettier-vscode icon indicating copy to clipboard operation
prettier-vscode copied to clipboard

There is a problem with the export type for typescript

Open Jeggery opened this issue 3 years ago • 0 comments

Summary

Format error when exporting using export type of typescript

Github Repository to Reproduce Issue

no

Steps To Reproduce:

  1. This is step 1.
  2. 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.

Jeggery avatar Jun 24 '22 09:06 Jeggery

Your version of prettier is outdated, you need to use a version of prettier that supports the version of typescript you are using.

ntotten avatar Aug 20 '22 19:08 ntotten