typescript - 新图像/新表/新按钮错误 Typescript 编译
问题描述
我正在创建一个 Google 操作,但我遇到new
了某些元素的关键字问题。例如这里:
conv.ask(new Table({
title: ``,
subtitle: '',
image: new Image({
url: '',
alt: 'Logo'
}),
columns: [
{
header: 'Line',
align: 'CENTER',
},
{
header: 'Destination',
align: 'LEADING',
},
{
header: 'Car',
align: 'TRAILING',
},
{
header: 'Arrival',
align: 'TRAILING',
},
],
rows: timetableCells,
buttons: new Button({
title: 'Button Title',
url: 'https://github.com/actions-on-google'
}),
}))
引用了任何地方new
我最终在编译时出现错误:
src/index.ts(21,20):错误 TS2304:找不到名称“表”。
src/index.ts(24,20):错误 TS2304:找不到名称“图像”。
src/index.ts(47,22):错误 TS2304:找不到名称“按钮”。
这是我的 tsconfig:
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",
"sourceMap": true,
"target": "es6"
},
"compileOnSave": true,
"include": [
"src"
]
}
我理解为什么会抛出这个错误,但我不确定这些来自 Google示例中的哪个库。
解决方案
哎呀,这比我想象的要明显得多。把这个留在这里,以防它帮助其他人。
import {dialogflow, Image, Table, Button} from 'actions-on-google';
推荐阅读
- c# - 如何在linq c#中获取项目值和项目数
- aws-lambda - 在 CodePipeline 中访问 CloudWatch 事件变量
- python - 如何在此 IF 条件下从列表的总和中获取特定索引?
- c - 当我运行程序时,线程在 N 发送后停止发送消息
- regex - 空格之间的值的正则表达式
- python - py2exe 的可执行文件停止运行
- python - 压缩 PIL 图像而不保存文件
- excel - 将多个范围添加到数组,然后使用 .value 复制/粘贴到新工作表
- javascript - 条件类名三元运算符渲染
- python - 从 django 中的另一个可重用应用程序加载应用程序