[英]How to import a js Module as any. (Without any declaration file (d.ts))
So I want to import a js module in my ts app.所以我想在我的ts应用程序中导入一个js模块。
Is there a way to do this without making a d.ts file or if not how to declare it as any in the d.ts file?有没有办法在不制作d.ts文件的情况下做到这一点,或者如果没有,如何在d.ts文件中将其声明为any ?
I am currently just ignoring this error with //@ts-ignore.我目前只是使用 //@ts-ignore 忽略此错误。
Thanks!谢谢!
There are two cases here:这里有两种情况:
import(...)
availableimport(...)
可用const module = (await import('module')) as any;
require(...)
require(...)
const module = require('module') as any;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.