Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier removes generic type annotation. #3568

Closed
omsharp opened this issue Nov 10, 2024 · 1 comment
Closed

Prettier removes generic type annotation. #3568

omsharp opened this issue Nov 10, 2024 · 1 comment

Comments

@omsharp
Copy link

omsharp commented Nov 10, 2024

Prettier removes generic types annotation.

original code:
let variable: Promise<boolean>;

after formatting turns into:
let variable: Promise;

VS Code Version: 1.95.2

Prettier Extension Version: v11.0.0

OS and version: Ubuntu 22.04.4 LTS, on WSL 2

Prettier Log Output

["INFO" - 1:43:07 PM] Using config file at /home/omar/code/saas-template/prettier.config.js
["INFO" - 1:43:09 PM] Formatting file:///home/omar/code/saas-template/src/app/%28public%29/layout.tsx
["INFO" - 1:43:09 PM] Using config file at /home/omar/code/saas-template/prettier.config.js
["INFO" - 1:43:09 PM] PrettierInstance:
{
"modulePath": "/home/omar/code/saas-template/node_modules/prettier/index.cjs",
"messageResolvers": {},
"version": "3.3.2"
}
["INFO" - 1:43:09 PM] Using ignore file (if present) at /home/omar/code/saas-template/.prettierignore
["INFO" - 1:43:09 PM] File Info:
{
"ignored": false,
"inferredParser": "typescript"
}
["INFO" - 1:43:09 PM] Detected local configuration (i.e. .prettierrc or .editorconfig), VS Code configuration will not be used
["INFO" - 1:43:09 PM] Prettier Options:
{
"filepath": "/home/omar/code/saas-template/src/app/(public)/layout.tsx",
"parser": "typescript",
"plugins": [
"/home/omar/code/saas-template/node_modules/.pnpm/[email protected][email protected]/node_modules/prettier-plugin-tailwindcss/dist/index.mjs"
],
"trailingComma": "none",
"tabWidth": 2,
"singleQuote": true
}
["INFO" - 1:43:09 PM] Formatting completed in 145ms.

@omsharp
Copy link
Author

omsharp commented Nov 10, 2024

Issue was solved for me.

1 - delete the node_modules directory for the project.
2 - reinstall packages.

node_modules/prettier was v3.3.2 and after deleting and reinstalling everything it got updated to v3.3.3 and that solved the problem.

@omsharp omsharp closed this as completed Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant