Using the TypeScript 2.7.1 language service in VS Code, I can get hinting for a module imported into a JavaScript file as:
const aModule = require('./aModule')
However, the type inference from the module includes the generic [x: string]: any;
Which means that I can get autocomplete for valid exports from the module, but cannot get a warning if I use:
aModule.something_that_doesnt_exist()
Is there a way to specify that the object is not extendable?
试试这个语法:
import * as aModule from './aModule';
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.