expressjs / cookie-parser

Parse HTTP request cookies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ FEATURE ] Support for ES6 imports

sanjaybaskaran01 opened this issue · comments

I've been trying to import cookieParser, it seems that there are no default exports setup for them.

import cookieParser from 'cookie-parser'; // Does not work

Could not find a declaration file for module 'cookie-parser'. '/node_modules/cookie-parser/index.js' implicitly has an 'any' type.

Expected Outcome:

import cookieParser from 'cookie-parser';

or

import * as cookieParser from 'cookie-parser';

Should import cookieParser

Hello, and thank you for your report. You can indeed import this module using es6. But the error you are showing is not from javascript/es6, rather from typescript. Here is an article that found which should help you: https://bobbyhadz.com/blog/typescript-could-not-find-a-declaration-file-for-module