vuejs / vue

This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
http://v2.vuejs.org
MIT License
207.69k stars 33.67k forks source link

Issue in single-file-component + typescript + typedoc or typescript/eslint #12301

Open iliubinskii opened 2 years ago

iliubinskii commented 2 years ago

What problem does this feature solve?

Sample code:

Here typedoc reports an issue "A is referenced by B, but not included in documentation." because B is exported and A is not.

The problem is that it reports line 2 while actual line is 4.

The same happens with typescript/eslint rules.

Obviousely, this happens because there is "<script lang=\"ts\">\n\n" code at the start of file and somehow typescript is not aware of it.

I could not create reproduction in playground because there is no template that would have vue + typedoc or typescript.

But I am ready to create reproduction repository on demand.

Also, I am not sure if this issue should be reported to vue or to typescript. If this is typescript issue, I will report it to them.

What does the proposed API look like?

The issue is that typescript nodes have incorrect tsNode.pos and tsNode.end after parsing single-file-component.

The should have correct position.

442623641 commented 2 years ago

Vue + TypeScript development tools, really good, greatly enhance the code maintenance and development efficiency vue-ts-toolkit