简体   繁体   中英

vscode typescript intellisense not working for evernote

I've installed https://www.npmjs.com/package/@types/evernote to my project to get evernote types definition.

When I import Evernote as follow

import { Evernote } from 'evernote';
const client = new Evernote.Client({
  consumerKey: '...',
  consumerSecret: '...',
  sandbox: true,
  token: '...'
});

Vscode recognize Evernote and suggests me autocompletion and lists all the available methods and objects. However, When I run my project, it says TypeError: Cannot read property 'Client' of undefined

When I import Evernote as below, I can run my app:

import * as Evernote from 'evernote';

But I don't get the autocompletion working.

How should I import my evernote module to make it works properly?

I've also tried

import Evernote = require('evernote');

but it doesn't work neither

  • import { Evernote } from 'evernote' is importing the named export Evernote .
  • import * as Evernote from 'evernote' is special TS syntax to import the module.
  • import Evernote from 'evernote' is importing the default export (note, you'll need to enable esModuleInterop or syntheticDefaultImports in your TSConfig.

You're looking for import { Client } from 'evernote' .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM