Swatinem / rollup-plugin-dts

A rollup plugin to generate .d.ts rollup files for your typescript project
GNU Lesser General Public License v3.0
806 stars 68 forks source link

[bug] error TS2339: Property X does not exist on type X #308

Open BowgartField opened 4 months ago

BowgartField commented 4 months ago

Checklist

Code Snipped

import { SecretsManagerClient, GetSecretValueCommand } from "@aws-sdk/client-secrets-manager";

export const getAwsSecrets = async (region: string, secretName: string) => {
    const client = new SecretsManagerClient({ region });
    const command = new GetSecretValueCommand({ SecretId: secretName });
    const response = await client.send(command);
    const secrets = JSON.parse(response.SecretString);
    for (const key in secrets){
        if(!process.env[key]){
            let val = secrets[key].trim()
            if(val === 'false') val = false
            if(val === 'true') val = true
            process.env[key] = val
           console.log(`env ${key} loaded from AWS Secrets Manager`)
        }else{
           console.log(`env ${key} loaded from AWS but not used because it is already set`)
        }
    }
}

Error Message

error TS2339: Property 'send' does not exist on type 'SecretsManagerClient'.

my rollup config

const typesBundle = await rollup({
      input: `src/${pkg}/index.ts`,
      plugins: [
          json(),
          dts()
      ],
  });
await typesBundle.write({
    format: 'cjs',
    file: `dist/${pkg}/index.d.ts`
});
heyikang commented 3 months ago

I have the same error

image