Skip to content

Library fails in typescript compilation with exactOptionalPropertyTypes=true #6668

@FranzZemen

Description

@FranzZemen

Checkboxes for prior research

Describe the bug

Pretty simple. Set exactOptionalPropertyTypes=true in 3.693.0 (this morning's latest NPM release) and compile. You will get transpiration errors such as:

BatchStatementRequest' is not assignable to type '{ Parameters?: any[]; }' with 'exactOptionalPropertyTypes: true

Set it to false, and there is no issue.

This causes problems for any project that is using the flag.

I have the following installed in my npm dependencies:

    "@aws-sdk/client-cloudwatch-logs": "^3.693.0",
    "@aws-sdk/client-s3": "^3.693.0",
    "@aws-sdk/credential-providers": "^3.693.0",
    "@aws-sdk/lib-dynamodb": "^3.693.0",

It does NOT happen in 3.687.0. Not sure about versions in between.

Node V20.2.0, Typescript 5.6.3 for both working and non-working versions

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Node V20.2.0, Typescript 5.6.3

Reproduction Steps

set exactOptionalPropertyTypes=true and transpile using tsc

Observed Behavior

Typescript errors within AWS v3 library such as

BatchStatementRequest' is not assignable to type '{ Parameters?: any[]; }' with 'exactOptionalPropertyTypes: true

Expected Behavior

No typescript errors

Possible Solution

workaround is to set exactOptionalPropertyTypes=false

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.guidanceGeneral information and guidance, answers to FAQs, or recommended best practices/resources.p2This is a standard priority issuepending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.queuedThis issues is on the AWS team's backlog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions