[ts] Could not find a declaration file for module '@antv/data-set'
按照官方的指引安装,并引用报错
npm install @antv/data-set;
import DataSet from '@antv/data-set';
错误信息如下:
[ts]
Could not find a declaration file for module '@antv/data-set'. '/home/likewise-open/SENSETIME/liulin/sense-radar/node_modules/@antv/data-set/build/data-set.js' implicitly has an 'any' type.
Try `npm install @types/antv__data-set` if it exists or add a new declaration (.d.ts) file containing `declare module 'antv__data-set';`
dataset 不是用 typescript 写的,目前也暂时没有 ts 定义文件,如果有兴趣可以帮我们整一个?
现在这个有解决方案了吗? @leungwensen 这个导致离线状态下没法使用g2组件,必须要用引入
按我的理解缺乏 type 定义文件并不会不能 work,这个报错只是开发时报错吧?我们没有使用 ts 技术栈,G2 的 ts 定义文件是社区提供的,如果有意帮助,欢迎 PR。
好吧,这个确实没辙。好不容易说服前端组长不用echarts改用bizcharts。无奈项目要求必须用typescript。
@LingHunJuJuDuXing 抱歉~ g2 目前内部在做 4.0,底层数据处理、绘图等所有模块都已经用 ts 改写了。不过正式上线要等一段时间
👍👍发自我的华为手机-------- 原始邮件 --------主题:Re: [antvis/data-set] [ts] Could not find a declaration file for module '@antv/data-set' (#43)发件人:绝云 收件人:antvis/data-set 抄送:liulin ,Author @LingHunJuJuDuXing 抱歉~ g2 目前内部在做 4.0,底层数据处理、绘图等所有模块都已经用 ts 改写了。不过正式上线要等一段时间
—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/antvis/data-set","title":"antvis/data-set","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/antvis/data-set"}},"updates":{"snippets":[{"icon":"PERSON","message":"@leungwensen in #43: @LingHunJuJuDuXing 抱歉~ g2 目前内部在做 4.0,底层数据处理、绘图等所有模块都已经用 ts 改写了。不过正式上线要等一段时间"}],"action":{"name":"View Issue","url":"https://github.com/antvis/data-set/issues/43#issuecomment-474696953"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/antvis/data-set/issues/43#issuecomment-474696953", "url": "https://github.com/antvis/data-set/issues/43#issuecomment-474696953", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
@LingHunJuJuDuXing 抱歉~ g2 目前内部在做 4.0,底层数据处理、绘图等所有模块都已经用 ts 改写了。不过正式上线要等一段时间
现在上线了吗
在 ts项目中报错,试试
const DataSet = require('@antv/data-set');
@LingHunJuJuDuXing 抱歉~ g2 目前内部在做 4.0,底层数据处理、绘图等所有模块都已经用 ts 改写了。不过正式上线要等一段时间
马上7月份了呀哥哥,
@LingHunJuJuDuXing 抱歉~ g2 目前内部在做 4.0,底层数据处理、绘图等所有模块都已经用 ts 改写了。不过正式上线要等一段时间
马上7月份了呀哥哥,
马上十月份了呀哥哥,
@LingHunJuJuDuXing 抱歉~ g2 目前内部在做 4.0,底层数据处理、绘图等所有模块都已经用 ts 改写了。不过正式上线要等一段时间
马上7月份了呀哥哥,
马上十月份了呀哥哥,
马上十二月份了呀哥哥,
还是不行,用require都不行
可以在项目里新建一个d.ts(比如 modules.d.ts) 文件 然后在里面写入
declare module '@antv/data-set';
就可以解决ts编译不通过的问题
别抄送我了,我已经解决之前的问题了,而且这是一年前的事情了
------------------ 原始邮件 ------------------ 发件人: "Jeffy"<[email protected]>; 发送时间: 2019年12月9日(星期一) 中午11:34 收件人: "antvis/data-set"<[email protected]>; 抄送: "799415090"<[email protected]>; "Comment"<[email protected]>; 主题: Re: [antvis/data-set] [ts] Could not find a declaration file for module '@antv/data-set' (#43)
可以在项目里新建一个d.ts(比如 modules.d.ts) 文件 然后在里面写入 declare module '@antv/data-set';
就可以解决ts编译不通过的问题
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
可以在项目里新建一个d.ts(比如 modules.d.ts) 文件 然后在里面写入
declare module '@antv/data-set';就可以解决ts编译不通过的问题
这个解决方案很棒,很多库都有这种问题,最好的解决方案就是在一个文件中申明下。