neoclide / coc-tsserver

Tsserver extension for coc.nvim that provide rich features like VSCode for javascript & typescript
MIT License
1.05k stars 68 forks source link

Property 'li' does not exist on type 'JSX.IntrinsicElements' #436

Closed adoreparler closed 9 months ago

adoreparler commented 1 year ago

I am new to react and every time I open or write regular html tags I get errors about them using coc-tsserver

## versions

vim version: VIM - Vi IMproved 9.0 9001424
node version: v20.3.1
coc.nvim version: 0.0.82-f52ab48c 2022-12-15 01:56:36 +0800
coc.nvim directory: /Users/seion/.vim/plugged/coc.nvim
term: Apple_Terminal
platform: darwin

## Log of coc.nvim

2023-06-27T16:25:31.106 INFO (pid:39257) [plugin] - coc.nvim initialized with node: v20.3.1 after 107
2023-06-27T16:25:38.416 INFO (pid:39257) [attach] - receive notification: showInfo []
Screenshot 2023-06-27 at 4 28 05 PM

Plugs:

call plug#begin()

" Polyglot is Syntax highlighting
Plug 'sheerun/vim-polyglot'

" Code Completion
Plug 'neoclide/coc.nvim', {'branch': 'release'}

" Side Bar
Plug 'preservim/nerdtree'

" ColorScheme
Plug 'NLKNguyen/papercolor-theme'

" Bottom Bar
Plug 'vim-airline/vim-airline'

Plug 'pangloss/vim-javascript'
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }

Plug 'OmniSharp/omnisharp-vim'
Plug 'dense-analysis/ale'
Plug 'nickspoons/vim-sharpenup'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'

call plug#end()
adoreparler commented 1 year ago
Screenshot 2023-06-28 at 9 44 16 AM
adoreparler commented 1 year ago

Also want to note that its able to detect all typescript and react elements just fine. Its only complaining about the regular HTML tags like div, li, ul, ect...

adoreparler commented 1 year ago

I think this is something to do with my tsconfig or node modules installed, because its not happening in another project that has tsx files in it

ivanalejandro0 commented 1 year ago

I was having this same problem (along with some others) and realized that coc-tsserver is using typescript 4.9.3, see: https://github.com/neoclide/coc-tsserver/blob/d8a2f44d64fcefaf6a2087cd5d0b7783393b73d7/package.json#L1180 and https://github.com/neoclide/coc-tsserver/blob/d8a2f44d64fcefaf6a2087cd5d0b7783393b73d7/yarn.lock#L184

and the project I was starting up was using typescript 5.0.2 and there were some incompatibilities.

I solved this by setting "tsserver.useLocalTsdk": true on the coc-settings.json. All the errors I was seeing went away.

I got the solution from https://github.com/neoclide/coc-tsserver/issues/434#issuecomment-1588758486, thanks @yaegassy for the explanation.

chemzqm commented 9 months ago

Fixed on coc-tsserver@2.1.4