新 Image/new Table/new 编译时出现按钮错误打字稿
new Image/new Table/new Button errors Typescript on compile
我正在创建一个 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): error TS2304: Cannot find name 'Table'.
src/index.ts(24,20): error TS2304: Cannot find name 'Image'.
src/index.ts(47,22): error TS2304: Cannot find name 'Button'.
这是我的 tsconfig:
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",
"sourceMap": true,
"target": "es6"
},
"compileOnSave": true,
"include": [
"src"
]
}
我理解为什么会出现此错误,但我不确定 Google 的 examples.
中的这些库来自哪个库
哎呀,这比我想象的要明显得多。把它留在这里以防它对其他人有帮助。
import {dialogflow, Image, Table, Button} from 'actions-on-google';
我正在创建一个 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): error TS2304: Cannot find name 'Table'.
src/index.ts(24,20): error TS2304: Cannot find name 'Image'.
src/index.ts(47,22): error TS2304: Cannot find name 'Button'.
这是我的 tsconfig:
{
"compilerOptions": {
"lib": ["es6"],
"module": "commonjs",
"noImplicitReturns": true,
"outDir": "lib",
"sourceMap": true,
"target": "es6"
},
"compileOnSave": true,
"include": [
"src"
]
}
我理解为什么会出现此错误,但我不确定 Google 的 examples.
中的这些库来自哪个库哎呀,这比我想象的要明显得多。把它留在这里以防它对其他人有帮助。
import {dialogflow, Image, Table, Button} from 'actions-on-google';