vscode typescript intellisense not working for evernote

心不动则不痛 提交于 2020-01-25 06:46:12

问题


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


回答1:


  • 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'.



来源:https://stackoverflow.com/questions/58566171/vscode-typescript-intellisense-not-working-for-evernote

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!