如何为TypeScript使用AWS sdk定义? [英] How do I use AWS sdk definitions for TypeScript?

查看:78
本文介绍了如何为TypeScript使用AWS sdk定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用从

这是我得到的错误:

/usr/local/bin/tsc --sourcemap SesTest.ts
SesTest.ts(3,9): error TS2304: Cannot find name 'SES'.

Process finished with exit code 2

我找不到有关如何进行此工作的任何文档.请帮忙!

更改为:

import AWS = require('aws-sdk'); 
var ses:AWS.SES = new AWS.SES();

注意:如果不清楚import,您可能想阅读以下模块: https://basarat.gitbooks.io/typescript/content/docs/project/modules.html

提示:查看测试文件的预期用途总是一个好主意:https://github.com/borisyankov/DefinitelyTyped/blob/master/aws-sdk/aws-sdk.d.ts

Here is what I've tried:

/// <reference path="../typings/aws-sdk.d.ts" />
var AWS = require('aws-sdk'); 
var ses:SES = new AWS.SES();

Here is the error that I get:

/usr/local/bin/tsc --sourcemap SesTest.ts
SesTest.ts(3,9): error TS2304: Cannot find name 'SES'.

Process finished with exit code 2

I cannot find any documentation on how to make this work. Please help!

解决方案

Change to :

import AWS = require('aws-sdk'); 
var ses:AWS.SES = new AWS.SES();

Note: if import is unclear you probably want to read up on modules : https://basarat.gitbooks.io/typescript/content/docs/project/modules.html

TIP: always a good idea to see the test file for intended usage : https://github.com/borisyankov/DefinitelyTyped/blob/master/aws-sdk/aws-sdk-tests.ts

这篇关于如何为TypeScript使用AWS sdk定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆