I am experimenting with using neovim
and have set up a minimal configuration as follows:
call plug#begin()
Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
Plug 'leafgarland/typescript-vim'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/denite.nvim'
call plug#end()
Within a nodejs
project, I have installed both pg
and @types/pg
:
npm i pg; npm i -D @types/pg;
Now, in a .ts
file, I am trying to import from pg
:
import * as pg from 'pg';
However, I am encountering an error on this line:
const queryLogger = (queryRes: QueryResult<object>): string => ...
> 2304: Cannot find name 'QueryResult'.
Interestingly, if I purposely introduce an error, the type is recognized as it makes reference to QueryResult<T>
:
const { Pool } = pg;
const pool = new Pool();
pool.query(sql, params) as string;
> 2352: Conversion of type 'Promise<QueryResult<any>>' ...
Even more peculiarly, when building and running the code, no errors are thrown - everything seems to function correctly, despite the reported error.
What could be causing this behavior? Are there additional steps I can take to troubleshoot this issue?