aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.98k stars 560 forks source link

PutKeyCommandOutput not found with Cloudfront KVS #5940

Closed trobert2 closed 3 months ago

trobert2 commented 3 months ago

Checkboxes for prior research

Describe the bug

When trying to import *CommandOutput interfaces to use as return types from @aws-sdk/client-cloudfront-keyvaluestore a linting error occurs. Example:

PutKeyCommandOutput not found in '@aws-sdk/client-cloudfront-keyvaluestore'eslintimport/named

This rule:

Verifies that all named imports are part of the set of named exports in the referenced module.

So given this function implementation:

export const setKVValue = async (
  kvsArn: string,
  key: string,
  value: string,
  etag: string,
): Promise<PutKeyCommandOutput> => {
  return await getKVClient().send(
    new PutKeyCommand({ Key: key, KvsARN: kvsArn, Value: value, IfMatch: etag }),
  );
};

I cannot import PutKeyCommandOutput to declare the type of the returned value.

Library version: "@aws-sdk/client-cloudfront-keyvaluestore": "3.540.0",

SDK version number

@aws-sdk/client-cloudfront-keyvaluestore@3.540.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v21

Reproduction Steps

import {
  PutKeyCommandOutput,
} from '@aws-sdk/client-cloudfront-keyvaluestore';

Observed Behavior

PutKeyCommandOutput not found in '@aws-sdk/client-cloudfront-keyvaluestore'eslintimport/named

Expected Behavior

The interfaces should be exported (use named exports)

Possible Solution

Improve named exports

Additional Information/Context

No response

kuhe commented 3 months ago

@aws-sdk/client-cloudfront-keyvaluestore does export PutKeyCommandOutput as a type.

Please create a minimal reproduction as a repository.

kuhe commented 3 months ago

Does this work?

use import type instead of import

import type {
  PutKeyCommandOutput,
} from '@aws-sdk/client-cloudfront-keyvaluestore';
aBurmeseDev commented 3 months ago

Hi @trobert2 - sorry to hear you're running into this error.

I have just tried to reproduce it but was unable to. Can you please try import type as suggested and share a minimal reproducible code if you have it?

Here's our API reference doc on PutKeyCommand and as you can see client exports PutKeyCommandOutput as Type.

Best, John

github-actions[bot] commented 3 months ago

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

github-actions[bot] commented 2 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.