i have tried using aws-sdk.ts file in mainmodule.ts file below. getting undefined error.
/// <reference path="aws.sdk.ts" /> import * aws 'aws.sdk'; var typescriptviewmodel = function (first, last) { var self = this; aws.config({ accesskeyid: 'abc', secretaccesskey: 'abcsecret' }); aws.config.region = 'us-east-1'; // many more usage of aws. got stuck on first implementation itself. //var bucket = new aws.s3({ // params: { // bucket: bucketname, prefix: path, delimiter: '/' // } // }); }
it throws error saying "uncaught typeerror: cannot read property 'config' of undefined".
can please guide me how use s3 bucket using aws.sdk.ts? new in typescript.
not sure being problem reference should be:
/// <reference path="aws.sdk.d.ts" />
instead of:
/// <reference path="aws.sdk.ts" />
then able import:
import * aws 'aws.sdk';
make sure have installed both type definitions:
$ typings install --global --save dt~aws-sdk
and npm module:
$ npm install --save aws-sdk
update
you have typings.json outside of awsdemo
folder using packages.config
(the visual studio way manage .d.ts
files):
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="aws-sdk.typescript.definitelytyped" version="1.9.4" targetframework="net451" /> <package id="node.typescript.definitelytyped" version="3.0.0" targetframework="net451" /> <package id="requirejs" version="2.2.0" targetframework="net451" /> <package id="requirejs.typescript.definitelytyped" version="0.4.3" targetframework="net451" /> </packages>
you can't use nuget , typings need use 1 of two.
i recommend follow official tutorial. tutorial explains how install angular ignore part , install aws-sdk instead. (you need es6-shim mentioned in tutorial) well.
Comments
Post a Comment