aws-lite

Using TypeScript

Introduction

Out of the box, the raw aws-lite client supports its own basic types for all core configuration and client requests.

Since most folks opt to use service plugins, optional service-specific types are available for all plugins in the @aws-lite/* namespace as @aws-lite/*-types.

For example, once you have installed @aws-lite/client and @aws-lite/dynamodb as dependencies, add the DynamoDB types as a dev dependency:

npm i -D @aws-lite/dynamodb-types

Configuration

JavaScript projects

In JavaScript projects, code completion (aka Intellisense) for input and output types are be loaded automatically for awsLite.<service>.<method> calls.

TypeScript projects

To make use of aws-lite types in TypeScript projects, include them in your tsconfig.json:

{
  "compilerOptions": {
    "types": [
      "@aws-lite/dynamodb-types"
    ]
  }
}

Under the hood

In general, both aws-lite and AWS’s official SDKs attempt to inherit the property names used in AWS’s low-level service API documentation. For example: setting the cache control value for an object in the S3 PutObject API is done via the cache-control header, but is referred to as CacheControl – this is the property name used by both aws-lite and AWS SDKs.

As such, @aws-lite/*-types are able to make use of @aws-sdk/* types under the hood. And while this generally works without issue, there may be occasional small difference due to technical necessities. For example: when enabling pagination in a request, non-paginated properties may not be present in the final response returned, thus deviating slightly from what may be present in the types. (This may also be true when using AWS SDKs as well.)

In general, it is a goal of @aws-lite/* to provide the maximum practical level of interoperability with the existing AWS property names, types, etc. We encourage you to contribute to aws-lite types wherever possible, or open an issue if you discover anything that looks incorrect.

aws-lite is an Apache 2.0-licensed open source project under the umbrella of OpenJS Foundation Architect. aws-lite is not in any way affiliated with Amazon Web Services, Inc. (AWS). All names and trademarks are the property of their respective owners.