Reputation: 18194
Can someone help me understand how different the namespace and module is?
AWS.d.ts
declare module AWS {
...
...
}
export = AWS
helper.d.ts
export declare namespace Helpers{
...
...
}
app.component.d.ts
import {Helpers} from 'mystartup_commons'; //<= works fine
import {AWS} from 'aws-sdk';
Error:
ERROR in /Users/ishandutta2007/Documents/Projects/myproj/src/app/app.component.ts (1,9): Module '"/Users/is handutta2007/Documents/Projects/myproj/node_modules/aws-sdk/typings/AWS"' has no exported member 'AWS'.)
Upvotes: 6
Views: 11501
Reputation: 70
Issue was resolve on Github: node_modules/aws-sdk/index has no default export #2654
Import module you want to use instead of AWS
from aws-sdk
Javascript sample:
const aws = require('aws-sdk')
let s3 = new aws.S3();
Typescript:
import { config, S3 } from 'aws-sdk';
import {
Buckets,
GetObjectOutput,
ListBucketsOutput,
PutObjectRequest
} from 'aws-sdk/clients/s3';
import { createReadStream } from 'fs';
Upvotes: -1
Reputation: 3661
I believe that the reason that the aws-sdk has no default export is because they want developers to only import the packages they need. e.g.
import { s3 } from 'aws-sdk';
Upvotes: 5
Reputation: 18194
adding a reference path to node's definition file and using * as
did the trick
app.component.d.ts
/// <reference path="../../node_modules/@types/node/index.d.ts"/>
import * as AWS from 'aws-sdk';
Upvotes: 14
Reputation: 8040
modeule
instead of module
Upvotes: 0