如何为TypeScript使用AWS sdk定义? [英] How do I use AWS sdk definitions for TypeScript?
问题描述
我正在尝试使用从 这是我得到的错误: 我找不到有关如何进行此工作的任何文档.请帮忙! 更改为: 注意:如果不清楚/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
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屋!