Answer the question
In order to leave comments, you need to log in
How do I import the ErrnoException type from @types/node?
@types/node defines type
ErrnoException
declare namespace NodeJS {
...
export interface ErrnoException extends Error {
errno?: number;
code?: string;
path?: string;
syscall?: string;
stack?: string;
}
...
import { ErrnoException } from '@types/node';
server.on('error', (error: ErrnoException) => {
if (error.syscall !== 'listen') reject(error);
error TS2306: File '/home/ubuntu/workspace/node_modules/@types/node/index.d.ts' is not a module.
Answer the question
In order to leave comments, you need to log in
Found the answer. It turns out the type is already imported in some miraculous way. Just had to correctly name it NodeJS.ErrnoException
server.on('error', (error: NodeJS.ErrnoException) => {
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question