Closed
Description
Describe the bug
When using PutMetricDataCommand
the field MetricData
expects a MetricDatum[]
. The Unit
field of MetricDatum
has in theory the type StandardUnit | string
. It looks like it gets coerced to string only because StardardUnit
is a union of string. We lose the autocompletion of the possible values for the unit. See
Your environment
SDK version number
@aws-sdk/[email protected]
Is the issue in the browser/Node.js/ReactNative?
Node.js
Details of the browser/Node.js/ReactNative version
v16.9.1
Steps to reproduce
import { PutMetricDataCommand } from '@aws-sdk/client-cloudwatch';
const cmd = new PutMetricDataCommand({
MetricData: [{
Unit: 'Count' // of type string so no autocompletion
}]
});
Observed behavior
The Unit
field is of type string, preventing autocompletion.
Expected behavior
The Unit
field should be of type StandardUnit
to allow for autocompletion.
Screenshots
Additional context
Using Typescript v4.4.3