Closed q32757468 closed 3 years ago
I need the rest of the log. Please see our guide on how to open a good issue and provide the missing information.
@ntotten that's complete log if using import type xxx from xxx
like
:
["INFO" - 上午11:14:51] Formatting e:\projects\my-projects\new-tab-naive\src\store\index.ts
["INFO" - 上午11:14:51] Using ignore file (if present) at e:\projects\my-projects\new-tab-naive.prettierignore
["INFO" - 上午11:14:51] File Info:
{
"ignored": false,
"inferredParser": "typescript"
}
["INFO" - 上午11:14:51] No local configuration (i.e. .prettierrc or .editorconfig) detected, falling back to VS Code configuration
["INFO" - 上午11:14:51] Prettier Options:
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "e:\projects\my-projects\new-tab-naive\src\store\index.ts",
"parser": "typescript"
}
["ERROR" - 上午11:14:51] Error formatting document.
["ERROR" - 上午11:14:51] '=' expected. (4:13)
2 | import { createStore, Module, useStore as baseUseStore } from "vuex";
3 | import siteNav from "./modules/siteNav";
4 | import type {NavItem} from "@/types" | ^ 5 | 6 | type ExtractM
= S extends Module<infer R, any> ? R : never; 7 | type Modules = typeof modules; SyntaxError: '=' expected. (4:13) 2 | import { createStore, Module, useStore as baseUseStore } from "vuex"; 3 | import siteNav from "./modules/siteNav"; 4 | import type {NavItem} from "@/types" | ^ 5 | 6 | type ExtractM= S extends Module<infer R, any> ? R : never; 7 | type Modules = typeof modules; at t (e:\projects\my-projects\new-tab-naive\node_modules\prettier\parser-typescript.js:1:347) at Object.parse (e:\projects\my-projects\new-tab-naive\node_modules\prettier\parser-typescript.js:14:180461) at Object.parse (e:\projects\my-projects\new-tab-naive\node_modules\prettier\index.js:9739:19) at coreFormat (e:\projects\my-projects\new-tab-naive\node_modules\prettier\index.js:13252:23) at format (e:\projects\my-projects\new-tab-naive\node_modules\prettier\index.js:13510:73) at formatWithCursor (e:\projects\my-projects\new-tab-naive\node_modules\prettier\index.js:13526:12) at e:\projects\my-projects\new-tab-naive\node_modules\prettier\index.js:44207:15 at Object.Success [as format] (e:\projects\my-projects\new-tab-naive\node_modules\prettier\index.js:44226:12) at t.default.(c:\Users\hsl.vscode\extensions\esbenp.prettier-vscode-8.0.1\src\PrettierEditService.ts:472:45) at Generator.next ( ) at i (c:\Users\hsl.vscode\extensions\esbenp.prettier-vscode-8.0.1\dist\extension.js:1:7003) ["INFO" - 上午11:14:51] Formatting completed in 78.1731ms.
You're likely either using an old version of prettier or an old version of typescript.
That being said, please see our docs on how to correctly get the logs for debugging.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Summary
If in typescript file includes code
import type xx from "xxx"
,Prettier seems not work ,but remove it Prettier work good.Github Repository to Reproduce Issue
Link to a Github repo that can be used to reproduce the issue.
Steps To Reproduce:
import type
like in typescript fileVS Code Version:1.58.0
Prettier Extension Version:8.01
OS and version: Windows10 21H1
Prettier Log Output