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

[Bug Report] the Volar support error in the document #3826

Closed
tolking opened this issue Oct 9, 2021 · 8 comments
Closed

[Bug Report] the Volar support error in the document #3826

tolking opened this issue Oct 9, 2021 · 8 comments
Assignees

Comments

@tolking
Copy link
Member

tolking commented Oct 9, 2021

Element Plus version

1.1.0-beta.19

OS/Browsers version

Vue version

3.2.20

Reproduction Link

https://element-plus.org/en-US/guide/quickstart.html#volar-support

Steps to reproduce

Follow the steps in the document will not take effect

Maybe compilerOptions.types -> include

// tsconfig.json
{
  "include": ["node_modules/element-plus/es/global.d.ts"]
}

What is Expected?

Prompt for global component type

What is actually happening?

No type related prompts

@sxzz
Copy link
Collaborator

sxzz commented Oct 9, 2021

For now,

--- "types": ["element-plus/global"]
+++ "types": ["element-plus/es/global"]

It has been fixed in #3756, and it will be released in next version. (today or tomorrow)

@tolking
Copy link
Member Author

tolking commented Oct 9, 2021

Still no effect, please check ts docs

@sxzz
Copy link
Collaborator

sxzz commented Oct 9, 2021

It works on my project. Please provide a minimum repo. (or your tsconfig.json)

@sxzz
Copy link
Collaborator

sxzz commented Oct 9, 2021

FYI, here are my tsconfig.json

{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "lib": ["esnext", "dom", "dom.iterable", "scripthost"],
    "allowJs": true,
    "checkJs": false,
    "jsx": "preserve",
    "sourceMap": true,
    "outDir": "./dist",
    "importHelpers": true,
    "strict": true,
    "noImplicitAny": false,
    "moduleResolution": "node",
    "baseUrl": "./",
    "paths": {
      "@/*": ["./src/*"]
    },
    "types": ["vite/client", "element-plus/es/global"],
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  },
  "include": ["./src*"],
  "exclude": ["node_modules"]
}

@sxzz
Copy link
Collaborator

sxzz commented Oct 9, 2021

I checked the problem, no need for .d.ts. element-plus/es/global just worked.

@tolking
Copy link
Member Author

tolking commented Oct 10, 2021

node v16.10.0
"typescript": "^4.4.3",

tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "useDefineForClassFields": true,
    "module": "esnext",
    "moduleResolution": "node",
    "strict": true,
    "jsx": "preserve",
    "sourceMap": true,
    "resolveJsonModule": true,
    "esModuleInterop": true,
    "lib": ["esnext", "dom"],
    "types": ["vite/client", "element-plus/es/global"]
  },
  "include": [
    "src/**/*.ts",
    "src/**/*.d.ts",
    "src/**/*.tsx",
    "src/**/*.vue"
  ]
}

main.ts

import { ElPagination } from 'element-plus'
//...
createApp(App).use(ElPagination).mount('#app')

current

current

expected

expected

@sxzz sxzz self-assigned this Oct 10, 2021
@xiaoxian521
Copy link
Member

This problem has been fixed, please use the latest version
image

@roy8800
Copy link

roy8800 commented Dec 7, 2021

i find a error

#4716

if the vue file use ts 4.5.2, hints no effect.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants