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

target: 2.7 throws error on aria-hidden attribute #1526

Closed
sodatea opened this issue Jun 30, 2022 · 2 comments · Fixed by #1533
Closed

target: 2.7 throws error on aria-hidden attribute #1526

sodatea opened this issue Jun 30, 2022 · 2 comments · Fixed by #1533
Assignees

Comments

@sodatea
Copy link
Member

sodatea commented Jun 30, 2022

Reproduction: https://stackblitz.com/edit/vitejs-vite-neriqf?file=src/App.vue
(Run npm run build to see the error)

Source code in App.vue:

  <button>
      <span class="fa fa-tweet" aria-hidden="true"></span>
      <span class="label"> Tweet </span>
    </button>

Error on type-checking:

src/App.vue:20:33 - error TS2322: Type '{ class: string; ariaHidden: string; "aria-hidden": "true"; }' is not assignable to type 'ElementAttrs<HTMLAttributes>'.
  Property 'ariaHidden' does not exist on type 'ElementAttrs<HTMLAttributes>'. Did you mean ''aria-hidden''?

20       <span class="fa fa-tweet" aria-hidden="true"></span>
                                   ~~~~~~~~~~~


Found 1 error in src/App.vue:20
@xiaoxiangmoe xiaoxiangmoe self-assigned this Jun 30, 2022
sodatea added a commit to vuejs/create-vue that referenced this issue Jun 30, 2022
Known caveats:
1. JSX not yet supported
2. Though `vue-template-compiler` is not required in most cases,
`@vue/test-utils` still requires it as a peer dependency.
3. `IconTooling.vue` was modified to circumvent a type-checking issue:
vuejs/language-tools#1526
@xiaoxiangmoe
Copy link
Collaborator

xiaoxiangmoe commented Jun 30, 2022

@johnsoncodehk @yyx990803

https://github.com/johnsoncodehk/volar/blob/152063583e0c167da6237115d6d29eb62c21c04c/packages/vue-typescript/src/lsContext.ts#L310-L318

It seems that Volar is relying on the filename runtime-dom.d.ts. Relying on filenames does not seem to be a good behavior. Seems like we need to get volar and vue to negotiate a more stable interface.

@rossinek
Copy link

rossinek commented Jul 2, 2022

I experienced the same problem and even created a simple reproduction (because I did not notice this thread):
https://stackblitz.com/edit/github-5pgg1d (run npm run tsc to see errors).

As you may notice neither expanding custom attrs nor default suppressing errors seems to work (unless I'm doing something wrong).

@johnsoncodehk johnsoncodehk linked a pull request Jul 6, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

3 participants