aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
Corrupt TS 3.4 declaration files in multiple packages
Checkboxes for prior research
- [X] I've gone through Developer Guide and API reference
- [X] I've checked AWS Forums and StackOverflow.
- [X] I've searched for previous similar issues and didn't find any solution.
Describe the bug
After installing, the package contains a corrupt typescript 3.4 declaration file.
For example when installing node_modules\@aws-sdk\client-lex-runtime-v2
the following file is corrupted:
node_modules\@aws-sdk\client-lex-runtime-v2\dist-types\ts3.4\models\models_0.d.ts
This only affects projects using typescript version <4
as dist-types\ts3.4
is set to be used for versions lower to 4 in package.json files using typesVersions
option
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
All
Details of the browser/Node.js/ReactNative version
node: v16.14.2 - yarn: 1.22.15
Reproduction Steps
Intall package in any project with yarn install @aws-sdk/client-lex-runtime-v2
Observed Behavior
The declaration file is corrupt and breaks compilations that use imports contained in it
Example error:
message: `/root/amplify-js/node_modules/@aws-sdk/client-lex-runtime-v2/dist-types/ts3.4/commands/GetSessionCommand.d.ts (4,29): Module '"../models/models_0"' has no exported member 'GetSessionResponse'. Did you mean 'PutSessionResponse'?`
Expected Behavior
The declaration file should be fine
Possible Solution
Stop using strip-comments
and search an alternative or stop stripping comments from declaration files at all
Additional Information/Context
The declaration file is generated using downlevel-dts
as you can see in package.json
The original declaration file is fine, located at:
node_modules\@aws-sdk\client-lex-runtime-v2\dist-types\models\models_0.d.ts
Tried to downlevel the declaration file locally using same downlevel-dts
version as in this project 0.7.0
and I got a correct file. So it does not seem to be a bug in downlevel-dts
.
Bug starts at 3.36.1
version, older versions contains not corrupted declarations file
EDIT: Found the problem:
strip-comments
used in this script is breaking the file, could reproduce the bug locally in my pc
Couldn't find any buildspec in this repo, so I think you are managing deploy configurations in a private repo, the script using strip-comments
shoould be called in the buildspec and probably it's generating corrupt files in other packages too